:where(*:not([data-voicy-payment-modal]):not([data-voicy-payment-modal] *):not([data-voicy-app-header]):not([data-voicy-app-header] *):not([data-voicy-modal]):not([data-voicy-modal] *):not([data-voicy-tour]):not([data-voicy-tour] *):not([data-voicy-toast]):not([data-voicy-toast] *)) {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Мобильная версия: без горизонтального скролла, контент по ширине экрана */
html {
    overflow-x: hidden;
    max-width: 100vw;
}

:root {
    --bg-primary: #070913;
    --bg-secondary: rgba(18, 20, 34, 0.64);
    --bg-tertiary: rgba(25, 27, 42, 0.72);
    --text-primary: #ffffff;
    --text-secondary: #a6a8b7;
    --accent: #a873ff;
    --accent-hover: #bc92ff;
    --border: rgba(118, 125, 153, 0.16);
    --border-light: rgba(151, 156, 184, 0.22);
    --success: #a873ff;
    --error: #ff4444;
    --warning: #ffaa00;
    --glass-bg: rgba(19, 21, 35, 0.62);
    --glass-bg-strong: rgba(23, 25, 40, 0.78);
    --glass-border: rgba(168, 115, 255, 0.28);
    --glass-shadow: 0 22px 60px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    /* Grainient-like purple background */
    --bg-gradient:
        radial-gradient(120% 90% at 8% 2%, rgba(168, 115, 255, 0.14) 0%, rgba(168, 115, 255, 0.05) 28%, transparent 60%),
        radial-gradient(80% 80% at 96% 8%, rgba(75, 91, 135, 0.14) 0%, rgba(75, 91, 135, 0.05) 32%, transparent 64%),
        linear-gradient(180deg, #0d101c 0%, #090b15 48%, #080912 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-primary);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    background-position: center;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    max-width: 100vw;
    overscroll-behavior-x: none;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) var(--bg-secondary);
}

body > .relative.flex.min-h-screen {
    background: transparent !important;
}

.grainient-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.grainient-bg canvas {
    width: 100%;
    height: 100%;
    display: block;
}

@media (max-width: 768px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    body {
        touch-action: auto;
    }
}

html {
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) var(--bg-secondary);
}

body::-webkit-scrollbar,
html::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

body::-webkit-scrollbar-track,
html::-webkit-scrollbar-track {
    background: #121316;
}

body::-webkit-scrollbar-thumb,
html::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 6px;
    border: 2px solid var(--bg-primary);
}

body::-webkit-scrollbar-thumb:hover,
html::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
    border-color: var(--bg-primary);
}

/* Анимация загрузки страницы */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
    visibility: visible;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.page-loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.page-loader-logo {
    font-size: 48px;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
    animation: logoPulse 2s ease-in-out infinite;
}

.page-loader-spinner {
    position: relative;
    width: 60px;
    height: 60px;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spinnerRotate 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
    animation-delay: -0.45s;
    border-top-color: var(--accent);
    opacity: 1;
}

.spinner-ring:nth-child(2) {
    animation-delay: -0.3s;
    border-top-color: rgba(0, 255, 136, 0.6);
    opacity: 0.8;
    transform: scale(0.8);
}

.spinner-ring:nth-child(3) {
    animation-delay: -0.15s;
    border-top-color: rgba(0, 255, 136, 0.4);
    opacity: 0.6;
    transform: scale(0.6);
}

@keyframes logoPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes spinnerRotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}
/* Telegram Mini App: учёт safe area (вырезы, нижняя панель) */
body.tg-mini-app {
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    min-height: var(--tg-viewport-stable-height, 100vh);
}

body.tg-mini-app .container {
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

/* Контейнер светящихся шариков на фоне — отключено */
.bg-balls {
    display: none !important;
}

/* Фоновые эффекты отключены */
.bg-glow,
.bg-beams {
    display: none !important;
}

.bg-glow::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -20%;
    width: 80%;
    height: 80%;
    background: radial-gradient(ellipse 100% 100% at 15% 15%,
            rgba(139, 92, 246, 0.28) 0%,
            rgba(168, 85, 247, 0.14) 45%,
            transparent 70%);
    filter: blur(40px);
}

.bg-glow::after {
    content: '';
    position: absolute;
    top: -30%;
    right: -20%;
    width: 80%;
    height: 80%;
    background: radial-gradient(ellipse 100% 100% at 85% 15%,
            rgba(139, 92, 246, 0.26) 0%,
            rgba(236, 72, 153, 0.1) 45%,
            transparent 70%);
    filter: blur(45px);
}

/* Свечение снизу (зеркально сверху) */
.bg-glow-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.bg-glow-bottom::before {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -20%;
    width: 80%;
    height: 80%;
    background: radial-gradient(ellipse 100% 100% at 15% 85%,
            rgba(139, 92, 246, 0.28) 0%,
            rgba(168, 85, 247, 0.14) 45%,
            transparent 70%);
    filter: blur(40px);
}

.bg-glow-bottom::after {
    content: '';
    position: absolute;
    bottom: -30%;
    right: -20%;
    width: 80%;
    height: 80%;
    background: radial-gradient(ellipse 100% 100% at 85% 85%,
            rgba(139, 92, 246, 0.26) 0%,
            rgba(236, 72, 153, 0.1) 45%,
            transparent 70%);
    filter: blur(45px);
}

/* Призматические лучи от центра (эффект как на Next.js Conf) */
.bg-beams {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Центральный источник света (призма) */
.bg-beams-source {
    position: absolute;
    left: 35%;
    bottom: 15%;
    width: 35%;
    height: 50%;
    background: radial-gradient(ellipse 60% 80% at 50% 80%,
            rgba(99, 102, 241, 0.2) 0%,
            rgba(139, 92, 246, 0.12) 25%,
            rgba(236, 72, 153, 0.06) 50%,
            transparent 75%);
    filter: blur(35px);
}

/* Широкий призматический луч вправо (синий → голубой → фиолетовый → розовый → оранжевый) */
.bg-beams-right {
    position: absolute;
    left: 40%;
    bottom: 25%;
    width: 75%;
    height: 35%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(59, 130, 246, 0.15) 5%,
            rgba(34, 211, 238, 0.2) 20%,
            rgba(139, 92, 246, 0.22) 35%,
            rgba(236, 72, 153, 0.18) 50%,
            rgba(251, 146, 60, 0.14) 65%,
            rgba(250, 204, 21, 0.08) 80%,
            transparent 100%);
    filter: blur(28px);
}

/* Тонкий луч влево (белый/голубой) */
.bg-beams-left {
    position: absolute;
    left: 0;
    bottom: 28%;
    width: 45%;
    height: 12%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(224, 231, 255, 0.12) 30%,
            rgba(191, 219, 254, 0.18) 55%,
            rgba(147, 197, 253, 0.1) 80%,
            transparent 100%);
    filter: blur(20px);
}

/* Анимированная волна на фоне — отключено */
.bg-wave {
    display: none !important;
}

/* Первый слой: волна со свечением (градиент) */
.bg-wave-gradient {
    position: absolute;
    top: 50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse 120% 100% at 50% 50%,
            rgba(0, 255, 136, 0.3) 0%,
            rgba(0, 255, 136, 0.15) 30%,
            transparent 60%);
    animation: waveMove 20s ease-in-out infinite;
    transform-origin: center center;
}

/* Второй слой: шум поверх волны */
.bg-wave-noise {
    position: absolute;
    top: 50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.5'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
    animation: waveMove 20s ease-in-out infinite;
    transform-origin: center center;
}

/* Дополнительный слой волны для глубины */
.bg-wave::before {
    content: '';
    position: absolute;
    top: 30%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse 100% 80% at 50% 50%,
            rgba(0, 255, 136, 0.25) 0%,
            rgba(0, 255, 136, 0.1) 25%,
            transparent 55%);
    animation: waveMove 25s ease-in-out infinite reverse;
    transform-origin: center center;
}

.bg-wave::after {
    content: '';
    position: absolute;
    top: 30%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter2'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter2)' opacity='0.4'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
    animation: waveMove 25s ease-in-out infinite reverse;
    transform-origin: center center;
}

@keyframes waveMove {
    0% {
        transform: translateX(-20%) translateY(-10%) rotate(0deg);
    }

    25% {
        transform: translateX(10%) translateY(5%) rotate(5deg);
    }

    50% {
        transform: translateX(-15%) translateY(-5%) rotate(-3deg);
    }

    75% {
        transform: translateX(5%) translateY(10%) rotate(4deg);
    }

    100% {
        transform: translateX(-20%) translateY(-10%) rotate(0deg);
    }
}

.bg-ball {
    position: absolute;
    border-radius: 50%;
    filter: blur(50px);
    opacity: 0;
    will-change: transform, opacity;
    transition: opacity 4s cubic-bezier(0.25, 0, 0.15, 1);
    overflow: hidden;
    contain: layout style paint;
    /* Предотвращает сдвиги layout */
    transform: translateZ(0);
    /* Аппаратное ускорение */
}

.bg-ball::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch' result='t'/%3E%3CfeColorMatrix in='t' type='saturate' values='0' result='gray'/%3E%3CfeGaussianBlur in='gray' stdDeviation='1.8' result='blur'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    opacity: 0.2;
    mix-blend-mode: overlay;
    pointer-events: none;
}

.bg-ball.is-visible {
    opacity: 0.58;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px 20px;
    padding-top: 64px;
    /* Точная высота хедера (padding 16 + логотип 32 + padding 16) */
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {

    html,
    body {
        overflow-x: hidden;
        max-width: 100vw;
        overflow-x: clip;
    }

    .container {
        max-width: 100%;
        width: 100%;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    .header {
        width: 100%;
    }
}

/* Header — fixed, full width */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 50;
    background: rgba(10, 12, 22, 0.72);
    /* bg-background-dark/90 */
    backdrop-filter: blur(18px) saturate(130%);
    -webkit-backdrop-filter: blur(18px) saturate(130%);
    border-bottom: 1px solid rgba(151, 156, 184, 0.18);
    /* border-border-dark */
    border-radius: 0;
    padding: 16px 24px;
    /* py-4 px-6 */
    margin: 0;
    transform: none;
    box-shadow: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.header .section-nav {
    margin-top: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.header .section-nav-btn {
    min-height: 0;
    padding: 8px 16px;
    flex-direction: row;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #94a3b8;
    border-radius: 0;
    background: transparent;
    border: none;
    position: relative;
    transition: color 0.2s ease;
    letter-spacing: 0.01em;
}

.header .section-nav-btn:hover {
    color: #f1f5f9;
    background: transparent;
}

.header .section-nav-btn.active {
    color: var(--accent);
    background: transparent;
}

/* Зелёная черта снизу для активной вкладки (как в Stitch V1) */
.header .section-nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 2px;
    background: var(--accent);
    border-radius: 9999px;
}

/* Иконки навигации разрешены */
.header .section-nav-btn .section-nav-icon {
    display: flex;
}

.header .section-nav-btn .section-nav-label {
    display: inline;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1280px;
    /* max-w-7xl */
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    /* gap-3 */
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    /* rounded-full */
    background: rgba(168, 115, 255, 0.1);
    border: 1px solid rgba(168, 115, 255, 0.85);
    /* bg-primary */
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    /* text-background-dark */
}

.logo-icon .material-symbols-outlined {
    font-size: 20px;
    /* text-xl */
    font-weight: 700;
}

.header-content .header-controls {
    contain: layout style;
}

.header-controls {
    display: flex !important;
    align-items: center;
    gap: 16px;
    height: 40px;
    visibility: visible !important;
    opacity: 1 !important;
}

#language-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    /* p-2 */
    color: #9ca3af;
    /* text-text-muted */
    background: transparent;
    border: none;
    border-radius: 9999px;
    /* rounded to match general style */
    cursor: pointer;
    transition: color 0.15s ease-in-out;
}

#language-toggle:hover {
    color: #f1f5f9;
    /* hover:text-slate-100 */
}

.theme-toggle {
    padding: 0;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    visibility: visible !important;
    opacity: 1 !important;
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.language-toggle {
    padding: 0;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    visibility: visible !important;
    opacity: 1 !important;
}

.language-text {
    font-size: 11px;
    font-weight: 700;
    color: inherit;
    line-height: 1;
    user-select: none;
    letter-spacing: 0.05em;
}

.language-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.btn-google {
    padding: 0 16px;
    height: 40px;
    background: #4285F4;
    border: 1px solid #4285F4;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.4s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    flex-shrink: 0;
    text-decoration: none;
}

.btn-google svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-google span {
    line-height: 1;
    display: flex;
    align-items: center;
}

.btn-google:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.user-profile-wrapper {
    position: relative;
    z-index: 60;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    transition: all 0.3s ease;
    flex-wrap: nowrap;
    flex-shrink: 0;
    cursor: pointer;
}

.user-profile:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
}

.user-profile-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg-primary);
    flex-shrink: 0;
}

.user-profile-icon svg {
    width: 16px;
    height: 16px;
}

.header-user-email {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1;
    display: flex;
    align-items: center;
}

.profile-dropdown-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.user-profile:hover .profile-dropdown-arrow {
    color: var(--accent);
}

.user-profile-wrapper:has(.profile-dropdown.show) .profile-dropdown-arrow {
    transform: rotate(180deg);
}

.profile-dropdown {
    position: fixed;
    top: auto;
    right: auto;
    min-width: 240px;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    z-index: 9999999 !important;
    display: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.profile-dropdown.show {
    display: block;
}

.profile-dropdown-content {
    padding: 6px;
}

.profile-dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2px;
}

.profile-dropdown-item:hover {
    background: var(--bg-secondary);
    color: #fff;
}

.profile-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.profile-dropdown-item:hover .profile-item-icon {
    color: #fff;
}

.profile-item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.profile-item-label {
    font-weight: 500;
    font-size: 14px;
}

.profile-item-value {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 6px 0;
}

.profile-dropdown-item#profile-logout-item {
    color: var(--error);
}

.profile-dropdown-item#profile-logout-item:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.btn-logout {
    padding: 0 16px;
    height: 40px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.btn-logout svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-logout span {
    line-height: 1;
    display: flex;
    align-items: center;
}

.btn-logout:hover {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

/* Экран входа (обязательная авторизация) */
.login-gate {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-gate-content {
    text-align: center;
    max-width: 360px;
}

.login-gate-content h2 {
    margin-bottom: 12px;
    font-size: 1.5rem;
}

.login-gate-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.login-gate-content .btn-google {
    margin: 0 auto;
}

.login-gate-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 20px;
    margin-bottom: 12px;
}

.login-gate-link {
    color: var(--accent);
    text-decoration: underline;
}

.login-gate-link:hover {
    opacity: 0.9;
}

/* Модальное окно выбора входа (Google / Telegram) */
/* Upscale Toggle (Matching remove-pauses style) */
.upscale-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
    cursor: pointer;
}

.upscale-toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.upscale-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(14, 16, 28, 0.86);
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
    border-radius: 28px;
}

.upscale-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: all 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.upscale-toggle-input:checked+.upscale-toggle-slider {
    background-color: var(--accent);
    border-color: var(--accent);
}

.upscale-toggle-input:checked+.upscale-toggle-slider:before {
    transform: translateX(22px);
}

.login-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 28px 24px;
    max-width: 400px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.login-modal-title {
    margin: 0 0 8px 0;
    font-size: 1.35rem;
    font-weight: 600;
}

.login-modal-desc {
    color: var(--text-secondary);
    margin: 0 0 20px 0;
    font-size: 0.95rem;
}

.login-modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-modal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    height: 48px;
    padding: 0 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.login-modal-btn:hover {
    opacity: 0.95;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-telegram {
    background: #0088cc;
    color: white;
    border: 1px solid #0088cc;
}

.login-modal-buttons .btn-google {
    height: 48px;
    min-height: 48px;
    padding: 0 20px;
}

.login-modal-buttons .btn-telegram {
    height: 48px;
    min-height: 48px;
    padding: 0 20px;
}

.btn-telegram:hover {
    background: #0077b5;
    border-color: #0077b5;
}

.login-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    padding: 0;
}

.login-modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* Промо-попап «10 000 токенов за регистрацию» */
.promo-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0);
    visibility: hidden;
    transition: background 0.45s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0.45s;
}

.promo-popup-overlay.visible {
    background: rgba(0, 0, 0, 0.55);
    visibility: visible;
    transition: background 0.45s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0s;
}

.promo-popup {
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: 16px;
    padding: 40px 32px 32px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(24px) scale(0.97);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.promo-popup::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(135deg,
            rgba(0, 255, 136, 0.4),
            rgba(0, 204, 255, 0.3),
            rgba(120, 0, 255, 0.25),
            rgba(0, 255, 136, 0.4));
    background-size: 300% 300%;
    animation: promoShimmer 4s ease infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.promo-popup::after {
    content: '';
    position: absolute;
    inset: -40%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(0, 255, 136, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 80%, rgba(0, 204, 255, 0.05) 0%, transparent 60%);
    filter: blur(30px);
    animation: promoGlow 6s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes promoGlow {
    from {
        transform: translate(-4%, -4%) scale(1);
    }

    to {
        transform: translate(4%, 4%) scale(1.05);
    }
}

@keyframes promoShimmer {
    0% {
        background-position: 0% 0%;
    }

    50% {
        background-position: 100% 100%;
    }

    100% {
        background-position: 0% 0%;
    }
}

.promo-popup-overlay.visible .promo-popup {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.promo-popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 0;
    transition: color 0.2s, background 0.2s;
    z-index: 2;
}

.promo-popup-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.promo-popup-subtitle {
    margin: 0 0 6px 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
}

.promo-popup-title {
    margin: 0 0 14px 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

.promo-popup-perks {
    list-style: none;
    margin: 0 0 22px 0;
    padding: 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.7;
    text-align: left;
    display: inline-block;
    position: relative;
    z-index: 1;
}

.promo-popup-perks li::before {
    content: '—';
    margin-right: 6px;
    opacity: 0.4;
}

.promo-popup-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.promo-popup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 20px;
    height: 44px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    color: white;
    cursor: pointer;
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.promo-popup-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.promo-popup-btn:active {
    transform: translateY(0);
}

.promo-popup-btn--primary {
    background: var(--accent);
    color: var(--bg-primary);
}

.promo-popup-btn--primary svg {
    opacity: 0.7;
}

.promo-popup-btn--secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.promo-popup-btn--secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 440px) {
    .promo-popup {
        padding: 32px 20px 24px;
        border-radius: 14px;
    }

    .promo-popup-title {
        font-size: 1.35rem;
    }
}

/* Модальное окно подтверждения входа через Telegram */
.telegram-confirm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    backdrop-filter: blur(4px);
}

.telegram-confirm-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    position: relative;
}

.telegram-confirm-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
    text-align: center;
}

.telegram-confirm-modal-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.telegram-confirm-modal-content p {
    margin: 0;
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.5;
}

.telegram-confirm-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.telegram-confirm-btn {
    flex: 1;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.telegram-confirm-btn.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
}

.telegram-confirm-btn.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
}

/* Confirm Modal (для подтверждения действий) */
.confirm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    margin: 0;
    pointer-events: auto;
}

.confirm-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: calc(100% - 40px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: slideUp 0.3s ease;
    margin: auto;
    flex-shrink: 0;
    pointer-events: auto;
    align-self: center;
}

.confirm-modal-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    color: #ff4444;
}

.confirm-modal-icon svg {
    width: 48px;
    height: 48px;
}

.confirm-modal-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    text-align: center;
}

.confirm-modal-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.confirm-modal-content p {
    margin: 0;
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
}

.confirm-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-modal-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    justify-content: center;
}

.confirm-modal-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.btn-confirm-danger {
    flex: 1;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: #ff4444;
    color: #ffffff;
}

.btn-confirm-danger:hover {
    background: #ff6666;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.4);
}

.btn-confirm-cancel {
    flex: 1;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-light);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-confirm-cancel:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    color: var(--accent);
}
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.telegram-confirm-btn.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.telegram-confirm-btn.btn-secondary:hover {
    background: var(--bg-primary);
    border-color: var(--border);
}

.header-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 18px;
    height: 36px;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    color: #000;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.header-login-btn:hover {
    background: #00e87a;
    box-shadow: 0 0 16px rgba(0, 255, 136, 0.35);
    transform: translateY(-1px);
}
/* Remove Pauses Zone (рядом с кнопкой загрузки аудио) */
.remove-pauses-zone {
    flex: 1;
    min-width: 280px;
    margin-top: 6px;
}

/* Remove Pauses Toggle Switch */
.remove-pauses-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.remove-pauses-control-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.remove-pauses-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
    cursor: pointer;
    margin-top: 6px;
    /* переключатель ВКЛ/ВЫКЛ чуть ниже, текст «Удалить паузы» без изменений */
}

.remove-pauses-toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.remove-pauses-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
    border-radius: 28px;
}

.remove-pauses-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: all 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.remove-pauses-toggle-input:checked+.remove-pauses-toggle-slider {
    background-color: var(--accent);
    border-color: var(--accent);
}

.remove-pauses-toggle-input:checked+.remove-pauses-toggle-slider:before {
    transform: translateX(22px);
}

.remove-pauses-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    user-select: none;
    display: flex;
    align-items: center;
    height: 28px;
}

.remove-pauses-slider-wrapper {
    display: none;
    align-items: center;
    gap: 8px;
    opacity: 0;
}

.remove-pauses-slider-wrapper.show {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    animation: removePausesSliderAppear 0.3s ease-out forwards;
}

@keyframes removePausesSliderAppear {
    0% {
        opacity: 0;
        filter: blur(12px);
        transform: translateY(24px);
    }

    100% {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
    }
}

.remove-pauses-slider-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.remove-pauses-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
    border: 1px solid var(--border-light);
}

.remove-pauses-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    transition: all 0.4s ease;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.6);
}

.remove-pauses-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.8);
}

.remove-pauses-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    transition: all 0.4s ease;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.6);
}

.remove-pauses-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.8);
}
.compression-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.compression-slider-wrapper.show {
    opacity: 1;
    pointer-events: auto;
}

.compression-slider-label-min,
.compression-slider-label-max {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.compression-crf-slider {
    width: 120px;
}

.compression-hint-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: help;
    flex-shrink: 0;
    line-height: 1;
}

.compression-hint-icon:hover {
    color: var(--accent);
    background: rgba(0, 255, 136, 0.12);
    border-color: var(--accent);
}

.remove-pauses-menu-wrapper {
    position: relative;
    margin-left: auto;
}

.remove-pauses-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.remove-pauses-menu-btn:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
    color: var(--accent);
}

.remove-pauses-menu-btn svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.remove-pauses-menu-wrapper:has(.remove-pauses-dropdown.show) .remove-pauses-menu-btn svg {
    transform: rotate(180deg);
}

.remove-pauses-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 120px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    z-index: 99999;
    display: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.remove-pauses-dropdown.show {
    display: block;
}

.remove-pauses-dropdown-content {
    padding: 4px;
}

.remove-pauses-dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
    border-radius: 6px;
    margin-bottom: 2px;
}

.remove-pauses-dropdown-item:hover {
    background: var(--bg-secondary);
    color: #fff;
}

.remove-pauses-dropdown-item.active {
    background: var(--bg-secondary);
    color: #fff;
    font-weight: 600;
}
.logo {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent) 0%, rgba(0, 255, 136, 0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 12px rgba(0, 255, 136, 0.6));
    letter-spacing: -0.5px;
    transition: filter 0.3s ease;
    margin-top: -6px;
    align-self: flex-start;
}

.logo:hover {
    filter: drop-shadow(0 0 16px rgba(0, 255, 136, 0.8));
}

.header-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.admin-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 24px;
    margin-bottom: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.admin-users-block,
.admin-grant-tokens-block {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.admin-users-title,
.admin-grant-tokens-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.admin-users-block .btn-secondary {
    margin-bottom: 12px;
}

.admin-users-table-wrap {
    overflow-x: auto;
    margin-bottom: 8px;
}

.admin-users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-users-table th,
.admin-users-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.admin-users-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
}

.admin-users-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.admin-users-count {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.admin-grant-tokens-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
}

.admin-grant-tokens-form label {
    margin-right: 4px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.admin-grant-input {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 160px;
}

.admin-grant-or {
    margin: 0 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.admin-grant-result {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.admin-grant-result.success {
    background: rgba(0, 255, 136, 0.15);
    color: var(--accent);
}

.admin-grant-result.error {
    background: rgba(255, 80, 80, 0.15);
    color: #ff5050;
}

.header-tokens-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 0;
    height: 40px;

}

.header-user-tokens {
    font-size: 14px;
    /* text-sm */
    font-weight: 700;
    /* font-bold */
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    color: #f1f5f9;
    /* Near white for the text, similar to screenshot */
    display: inline-flex;
    align-items: center;
    gap: 8px;
    /* gap-2 */
    padding: 6px 12px;
    /* px-3 py-1.5 */
    height: auto;
    background: rgba(19, 21, 35, 0.72);
    /* EXACT match bg-border-dark */
    border: 1px solid rgba(151, 156, 184, 0.28);
    /* EXACT match border-border-dark */
    border-radius: 16px;
    /* EXACT match rounded-lg (1rem) */
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s ease, box-shadow 0.2s ease;
    pointer-events: auto;
}

.header-user-tokens:hover {
    background: rgba(38, 30, 62, 0.78);
    /* hover:bg-border-dark/80 */
    transform: scale(1.06);
    box-shadow: none;
}

.header-user-tokens:focus-visible {
    transform: scale(1.06);
}

.header-user-tokens .tokens-value-stack {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--tokens-compact-width, 4ch);
    overflow: hidden;
    height: 20px;
    font-variant-numeric: tabular-nums;
    transition: width 0.2s ease;
}

.header-user-tokens:hover .tokens-value-stack,
.header-user-tokens:focus-visible .tokens-value-stack {
    width: var(--tokens-full-width, 6ch);
}

.header-user-tokens .tokens-value {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    white-space: nowrap;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.header-user-tokens .tokens-value-full {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    opacity: 0;
    white-space: nowrap;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: #ffffff;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.header-user-tokens:hover .tokens-value,
.header-user-tokens:focus-visible .tokens-value {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.04);
}

.header-user-tokens:hover .tokens-value-full,
.header-user-tokens:focus-visible .tokens-value-full {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Tokens pill: зелёная кнопка + */
.header-user-tokens .plus-icon {
    font-size: 14px;
    /* text-sm matching screenshot */
    color: #10b981;
    /* Default tailwind emerald/green text-primary */
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Header Icon Buttons (Language, Theme) */
.header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: transparent;
    border: none;
    color: #a0a5b5;
    /* text-text-muted */
    cursor: pointer;
    border-radius: 8px;
    transition: color 0.2s, background-color 0.2s;
}

.header-icon-btn:hover {
    color: #f1f5f9;
    /* hover:text-slate-100 */
    background: rgba(255, 255, 255, 0.05);
    /* subtle background on hover */
}

.header-icon-btn .material-symbols-outlined {
    font-size: 20px;
    /* text-xl */
}

/* Скрываем старую кнопку Пополнить (если где-то осталась) */
.header-buy-tokens-btn {
    display: none !important;
}

@media (max-width: 480px) {

    /* Removed old mobile tokens styling */
    .header-tokens-plus-btn {
        display: flex !important;
        /* Показываем кнопку "+" в мобильной версии */
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        min-width: 24px;
        padding: 0;
        margin-left: 8px;
        background: var(--bg-tertiary);
        border: 1px solid var(--border-light);
        border-radius: 50%;
        color: var(--text-primary);
        cursor: pointer;
        flex-shrink: 0;
        transition: all 0.2s ease;
        pointer-events: auto;
    }

    .header-tokens-plus-btn:hover,
    .header-tokens-plus-btn:active {
        background: var(--accent);
        color: var(--bg-primary);
        border-color: var(--accent);
        transform: scale(1.1);
    }

    .header-tokens-plus-btn svg {
        width: 14px;
        height: 14px;
        pointer-events: none;
    }

    .header-user-tokens .tokens-value,
    .header-user-tokens .tokens-value-full {
        flex: 1;
        text-align: center;
    }

    /* Скрываем отдельную кнопку пополнения в мобильной версии */
    .header-buy-tokens-btn {
        display: none !important;
    }

    /* Центрируем хедер на мобильных */
    .header-content {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 12px;
        justify-content: center;
    }

    .header-left {
        justify-self: center;
    }

    .header-content .header-controls {
        justify-self: center;
        margin-left: 0;
    }

    .header-content .header-tokens-wrapper {
        justify-self: center;
        margin-left: 0;
    }
}

@keyframes tokenDotPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.3);
    }
}


.header-buy-tokens-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    height: 40px;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.header-buy-tokens-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.header-buy-tokens-btn span {
    line-height: 1;
    display: flex;
    align-items: center;
}

.header-buy-tokens-btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
    transform: scale(1.05);
}

.header-buy-tokens-btn.low-balance {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.header-buy-tokens-btn.low-balance:hover {
    background: #00e699;
    border-color: #00e699;
}


.user-tokens-info {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.user-tokens-label {
    color: var(--text-secondary);
    margin-right: 8px;
}

.user-tokens-value {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--accent);
}

.user-tokens-guest {
    margin-bottom: 16px;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Cards */
.card {
    background: var(--glass-bg);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    border: 1px solid var(--border-light);
    position: relative;
    backdrop-filter: blur(18px) saturate(125%);
    -webkit-backdrop-filter: blur(18px) saturate(125%);
    z-index: 0;
    /* Базовый z-index для карточки */
    overflow: visible;
    box-shadow: var(--glass-shadow);
    transition: border-color 0.4s ease, background 0.4s ease;
}

.card:has(.voice-library-filter-dropdown.show) {
    z-index: 10000000 !important;
    position: relative;
    contain: none;
    /* Убираем contain, чтобы dropdown мог выйти за пределы карточки */
    overflow: visible;
}

.card:hover {
    border-color: var(--border-light);
}

/* Кнопки генерации в Voice Changer и Dubbing должны быть ниже dropdown в stacking context */
.voice-changer-section,
.dubbing-section {
    position: relative;
    overflow: visible;
}

/* Поля параметров дубляжа: количество спикеров и временной диапазон — как у селектов */
.dubbing-param-input {
    width: 100%;
    max-width: 140px;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.dubbing-param-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.2);
}

.dubbing-param-input::placeholder {
    color: var(--text-tertiary);
}

.dubbing-param-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dubbing-param-block .dubbing-param-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.dubbing-time-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dubbing-time-row .dubbing-param-input {
    max-width: 100px;
    width: 100px;
}

.dubbing-time-row .dubbing-time-sep {
    color: var(--text-tertiary);
    font-weight: 500;
    user-select: none;
}

.dubbing-time-row .dubbing-param-hint {
    margin-top: 0;
    margin-left: 4px;
}
.voice-changer-section .btn-primary,
.dubbing-section .btn-primary {
    z-index: 0 !important;
    position: relative;
    margin-top: 24px;
    /* Дополнительный отступ для визуального разделения */
}

.voice-changer-section #voice-changer-btn {
    background: #0a0a0a;
    border: 1px solid #2a2b2e;
    height: 56px;
    margin-top: 4px;
}

.voice-changer-section #voice-changer-btn:hover {
    background: #1a1b1e;
    border-color: #35373b;
}

.voice-changer-section #voice-changer-btn svg {
    color: #ffffff;
}

.voice-changer-section #voice-changer-btn:disabled {
    opacity: 1;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--accent) 0%, rgba(0, 255, 136, 0.7) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 8px rgba(0, 255, 136, 0.3));
    position: relative;
    z-index: 1;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.form-group:has(.voice-dropdown.show),
.form-group:has(.model-dropdown.show) {
    z-index: 999999;
    position: relative;
    isolation: isolate;
    /* Изолируем stacking context для dropdown */
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.form-row:has(.voice-dropdown.show),
.form-row:has(.model-dropdown.show) {
    z-index: 999999;
    position: relative;
}

.model-controls-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.textarea-input,
.select-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.textarea-input {
    resize: vertical;
    min-height: 80px;
}

.textarea-input:focus,
.select-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(168, 115, 255, 0.2), 0 0 22px rgba(168, 115, 255, 0.12);
}

/* Поля выбора голоса и модели — без зелёной обводки при фокусе, как у блока голоса */
.voice-input:focus,
.model-input:focus {
    border-color: var(--border-light);
    box-shadow: none;
}

.textarea-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.split-textarea-wrapper {
    position: relative;
    width: 100%;
}

.split-textarea-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: auto;
    color: var(--text-primary);
    display: none;
}

.split-textarea-overlay::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.split-textarea-overlay {
    scrollbar-width: none;
}

.textarea-input.split-audio-active {
    color: transparent !important;
    -webkit-text-fill-color: transparent;
    caret-color: var(--text-primary);
}
.textarea-input.split-audio-active::placeholder {
    color: var(--text-secondary);
    -webkit-text-fill-color: var(--text-secondary);
    opacity: 0.6;
}

.split-audio-slash {
    color: var(--accent);
}

.split-audio-placeholder-text {
    color: var(--text-secondary);
    opacity: 0.6;
}

#split-audio-auto-punctuation-row {
    display: flex;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transform: translateY(-4px) scaleY(0.96);
    transform-origin: top left;
    margin-top: 0;
    transition: max-height 0.28s ease, opacity 0.2s ease, transform 0.28s ease, margin-top 0.28s ease;
}

#split-audio-auto-punctuation-row.is-visible {
    max-height: 40px;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scaleY(1);
    margin-top: 2px;
}

#split-audio-settings-group {
    transition: transform 0.28s ease;
}

#split-audio-settings-group.with-auto-visible {
    transform: translateY(10px);
}

@media (max-width: 768px) {
    .textarea-input.split-audio-active {
        font-size: 13px !important;
        line-height: 1.35;
    }
}

.select-wrapper {
    position: relative;
    display: flex;
    gap: 8px;
    z-index: 1;
}

.select-wrapper:has(.voice-dropdown.show),
.select-wrapper:has(.model-dropdown.show),
.select-wrapper:has(.voice-library-filter-dropdown.show) {
    z-index: 10000000 !important;
    position: relative;
}

.voice-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    z-index: 999999;
}

.voice-input-wrapper:has(.voice-dropdown.show) {
    z-index: 999999;
}

.voice-input {
    padding-right: 40px;
}

.voice-dropdown-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: transparent;
    border: none;
    border-left: 1px solid var(--border-light);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s ease;
    border-radius: 0 8px 8px 0;
}

.voice-dropdown-btn:hover {
    background: var(--bg-primary);
    color: #fff;
}

.voice-dropdown-btn.active {
    background: var(--bg-primary);
    color: #fff;
}

.voice-dropdown-btn.active svg {
    transform: rotate(180deg);
}

.voice-dropdown-btn svg {
    transition: transform 0.4s ease;
}

.voice-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #191b2a;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    min-height: 180px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 9999999 !important;
    display: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.voice-dropdown.show {
    display: block;
}

.voice-dropdown-content {
    padding: 4px;
    display: flex;
    flex-direction: column;
}

.voice-dropdown-pinned-actions {
    position: sticky;
    top: 0;
    z-index: 2;
    order: -1;
    padding-bottom: 4px;
    background: #191b2a;
}

.voice-dropdown-loading {
    padding: 12px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.voice-dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.4s ease;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 4px;
}

.voice-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.voice-item-name {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.3;
}

.voice-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.voice-item-description-container {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 2px;
}

.voice-item-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.voice-item-description.expanded {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.voice-description-expand-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: -2px;
}

.voice-description-expand-btn:hover {
    color: var(--accent);
    background: var(--bg-primary);
}

.voice-description-expand-btn svg {
    transition: transform 0.3s ease;
}

.voice-favorite-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 4px;
    flex-shrink: 0;
}

.voice-favorite-btn:hover {
    color: var(--accent);
    background: var(--bg-primary);
}

.voice-favorite-btn.active {
    color: var(--accent);
}

.voice-favorite-btn.active svg {
    fill: var(--accent);
    stroke: var(--accent);
}

.voice-favorite-btn svg {
    fill: none;
    transition: fill 0.3s ease;
}

.voice-preview-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 6px;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
}

.voice-preview-btn:hover {
    color: var(--accent);
    background: var(--bg-secondary);
    border-color: var(--accent);
}

.voice-preview-btn.playing {
    color: var(--accent);
    background: var(--bg-secondary);
    border-color: var(--accent);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.4);
    }

    50% {
        box-shadow: 0 0 0 4px rgba(0, 255, 136, 0);
    }
}

.voice-dropdown-item.favorite {
    border-left: 3px solid var(--accent);
    background: rgba(0, 255, 136, 0.05);
}

.voice-dropdown-item.voice-paid {
    opacity: 0.55;
}

.voice-dropdown-item.voice-paid .voice-item-name {
    color: var(--text-secondary);
}

.voice-paid-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(255, 170, 0, 0.15);
    color: #ffaa00;
    border: 1px solid rgba(255, 170, 0, 0.3);
    white-space: nowrap;
    margin-right: 4px;
    line-height: 1.4;
}

.voice-preview-btn svg {
    width: 14px;
    height: 14px;
}

.voice-dropdown-item:hover {
    background: var(--bg-secondary);
    color: #fff;
}

.voice-dropdown-item:hover .voice-item-name {
    color: #fff;
}

.voice-dropdown-item:hover .voice-item-description {
    color: var(--text-primary);
}

.voice-dropdown-item.active {
    background: var(--bg-secondary);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.voice-dropdown-item.active .voice-item-name {
    color: #fff;
}

.custom-voice-upload-item {
    border: 1px solid rgba(34, 211, 238, 0.32);
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.12), rgba(99, 102, 241, 0.08));
}

.custom-voice-badge {
    background: rgba(34, 211, 238, 0.14);
    color: #67e8f9;
    border-color: rgba(34, 211, 238, 0.28);
}

.custom-voice-modal-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(3, 7, 18, 0.72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.custom-voice-modal {
    position: relative;
    width: min(520px, 100%);
    padding: 28px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 24px;
    background:
        radial-gradient(circle at 18% 0%, rgba(34, 211, 238, 0.18), transparent 34%),
        linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98));
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
    color: #fff;
}

.custom-voice-section {
    display: flex;
    justify-content: center;
    padding: clamp(18px, 4vw, 42px);
}

.custom-voice-inline-card {
    width: min(720px, 100%);
    overflow: hidden;
}

.custom-voice-inline-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(110deg, rgba(103, 232, 249, 0.08), transparent 42%, rgba(255, 255, 255, 0.05));
}

.custom-voice-inline-card > * {
    position: relative;
    z-index: 1;
}

.custom-voice-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.78);
    color: #cbd5e1;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.custom-voice-modal-kicker {
    margin-bottom: 8px;
    color: #67e8f9;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.custom-voice-modal-title {
    margin: 0 36px 10px 0;
    font-size: 28px;
    line-height: 1.1;
}

.custom-voice-modal-desc {
    margin: 0 0 22px;
    color: #a0a5b5;
    line-height: 1.55;
}

.custom-voice-field,
.custom-voice-file-field {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
    color: #e5e7eb;
    font-size: 13px;
    font-weight: 600;
}

.custom-voice-field input,
.custom-voice-file-field input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.74);
    color: #fff;
    padding: 13px 14px;
    outline: none;
}

.custom-voice-file-field small,
.custom-voice-upload-status {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 400;
}

.custom-voice-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 22px;
}

.voice-dropdown-empty {
    padding: 12px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Model dropdown styles (same as voice dropdown) */
.model-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    z-index: 999999;
}

.model-input-wrapper:has(.model-dropdown.show) {
    z-index: 999999;
}

.model-input {
    padding-right: 40px;
    cursor: pointer;
}

.model-dropdown-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: transparent;
    border: none;
    border-left: 1px solid var(--border-light);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s ease;
    border-radius: 0 8px 8px 0;
}

.model-dropdown-btn:hover {
    background: var(--bg-primary);
    color: #fff;
}

.model-dropdown-btn.active {
    background: var(--bg-primary);
    color: #fff;
}

.model-dropdown-btn.active svg {
    transform: rotate(180deg);
}

.model-dropdown-btn svg {
    transition: transform 0.4s ease;
}

.model-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #191b2a;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    max-height: calc(100vh - 20px);
    /* Будет переопределено через JS для точного расчета */
    overflow-y: auto;
    z-index: 9999999 !important;
    display: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.model-dropdown.show {
    display: block;
}

/* В разделе Фото: модель, соотношение сторон и количество открываются вверх */
#photo-model-dropdown,
#photo-aspect-dropdown,
#photo-count-dropdown {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
}

.model-dropdown-content {
    padding: 6px;
}

.model-dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 13px;
    transition: all 0.4s ease;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 2px;
}

.model-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}

.model-item-name {
    flex: 1;
    font-weight: 500;
}

.model-item-discount-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 255, 136, 0.1));
    color: var(--accent);
    font-weight: 600;
    border: 1px solid rgba(0, 255, 136, 0.3);
    white-space: nowrap;
    margin-left: auto;
}

.model-item-cost {
    font-size: 12px;
    color: var(--accent);
    font-weight: 500;
    margin-top: 2px;
    opacity: 0.9;
}

.model-item-variations {
    font-size: 12px;
    color: var(--accent);
    font-weight: 500;
    margin-top: 2px;
    opacity: 0.9;
}

.model-item-description {}

/* Стили для элементов выбора языков (model-option) */
.model-option {
    padding: 10px 14px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
    border-radius: 6px;
    margin-bottom: 2px;
}

.model-option:hover {
    background: var(--bg-secondary);
    color: #fff;
}

.model-option:active {
    background: var(--bg-primary);
    transform: scale(0.98);
}

.dubbing-lang-dropdown {
    min-height: 0;
    max-height: 220px;
}

.model-favorite-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 4px;
    flex-shrink: 0;
}

.model-favorite-btn:hover {
    color: var(--accent);
    background: var(--bg-primary);
}

.model-favorite-btn.active {
    color: var(--accent);
}

.model-favorite-btn.active svg {
    fill: var(--accent);
    stroke: var(--accent);
}

.model-favorite-btn svg {
    width: 14px;
    height: 14px;
    fill: none;
    transition: fill 0.3s ease;
}

.model-dropdown-item.favorite {
    border-left: 3px solid var(--accent);
    background: rgba(0, 255, 136, 0.05);
}

.model-item-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    white-space: nowrap;
}

.model-item-description {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
    margin-top: 0;
}

.model-item-cost {
    font-size: 11px;
    color: var(--accent);
    font-weight: 500;
    margin-top: 0;
}

.model-dropdown-item:hover {
    background: var(--bg-secondary);
    color: #fff;
}

.model-dropdown-item:hover .model-item-name {
    color: #fff;
}

.model-dropdown-item:hover .model-item-description {
    color: var(--text-primary);
}

.model-dropdown-item:hover .model-item-tag {
    background: var(--bg-secondary);
    border-color: var(--border-light);
    color: #fff;
}

.model-dropdown-item.active {
    background: var(--bg-secondary);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.model-preview-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 6px;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
}

.model-preview-btn:hover {
    color: var(--accent);
    background: var(--bg-secondary);
    border-color: var(--accent);
}

.model-preview-btn.playing {
    color: var(--accent);
    background: var(--bg-secondary);
    border-color: var(--accent);
    animation: pulse 1.5s ease-in-out infinite;
}

.model-preview-btn svg {
    width: 14px;
    height: 14px;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.4);
    }

    50% {
        opacity: 0.8;
        box-shadow: 0 0 0 4px rgba(0, 255, 136, 0);
    }
}

.model-dropdown-item.active .model-item-name {
    color: #fff;
}

.model-dropdown-item.active .model-item-description {
    color: var(--text-primary);
}

.model-dropdown-item.active .model-item-tag {
    background: var(--bg-primary);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

.select-wrapper:has(.model-dropdown.show) {
    z-index: 1000;
}

/* Скроллбар для model dropdown */
.model-dropdown::-webkit-scrollbar {
    width: 8px;
}

.model-dropdown::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.model-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

.model-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Скроллбар для dropdown */
.voice-dropdown::-webkit-scrollbar {
    width: 8px;
}

.voice-dropdown::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.voice-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

.voice-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Глобальные стили скроллбаров */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) var(--bg-secondary);
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
    border: 2px solid var(--bg-secondary);
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
    border-color: var(--bg-secondary);
}

/* Скроллбар для фильтров библиотеки голосов */
.voice-library-filter-dropdown::-webkit-scrollbar {
    width: 8px;
}

.voice-library-filter-dropdown::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.voice-library-filter-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

.voice-library-filter-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Скроллбар для профильного dropdown */
.profile-dropdown::-webkit-scrollbar {
    width: 8px;
}

.profile-dropdown::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.profile-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

.profile-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Скроллбар для модальных окон */
.modal-content::-webkit-scrollbar,
.confirm-modal::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track,
.confirm-modal::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb,
.confirm-modal::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover,
.confirm-modal::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}
.btn-icon {
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.2);
}

/* Sliders */
.sliders-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 24px 0;
    position: relative;
    z-index: 0 !important;
    /* Всегда ниже dropdown'ов */
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 0 !important;
}

.slider-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.param-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    cursor: help;
    vertical-align: middle;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.param-help:hover {
    color: var(--accent);
    background: rgba(0, 255, 136, 0.12);
    border-color: var(--accent);
}

.section-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.section-title-row .section-title {
    margin-bottom: 0;
}

.section-tour-help {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-left: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    cursor: help;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.section-tour-help:hover {
    color: var(--accent);
    background: rgba(0, 255, 136, 0.12);
    border-color: var(--accent);
}

/* Кастомная подсказка для параметров (показывается сразу при наведении) */
.param-help-tooltip {
    position: fixed;
    z-index: 10000;
    max-width: 320px;
    width: min(320px, calc(100vw - 16px));
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    display: none;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
    border: 1px solid var(--border-light);
    position: relative;
    z-index: 0 !important;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    transition: all 0.4s ease;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.6);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.8);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    transition: all 0.4s ease;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.6);
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.8);
}

/* Toggle Switch */
.toggle-switch-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch-input {
    display: none;
}

.toggle-switch-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
    flex-shrink: 0;
}

.toggle-switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch-input:checked+.toggle-switch-slider {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle-switch-input:checked+.toggle-switch-slider::before {
    transform: translateX(20px);
}

.toggle-switch-text {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.toggle-switch-label:hover .toggle-switch-slider {
    border-color: var(--accent);
}

.toggle-switch-label:hover .toggle-switch-text {
    color: var(--accent);
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-family: inherit;
    position: relative;
    z-index: 1;
}

/* Убеждаемся что кнопки всегда ниже dropdown'ов */
.btn-primary {
    z-index: 0;
    background: var(--bg-secondary);
    color: #ffffff;
    width: 100%;
    justify-content: center;
    margin-top: 8px;
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

#voice-changer-btn {
    font-size: 16px;
    font-family: inherit;
    border-radius: 12px;
}

#dubbing-btn {
    font-size: 16px;
    font-family: inherit;
    margin-top: 0;
    height: 58px;
    padding: 0 28px;
    border-radius: 12px;
}

#dubbing-btn svg {
    color: #ffffff;
}

#dubbing-btn:hover {
    border-color: var(--border-light);
}

/* Иконка внутри кнопки генерации остаётся зелёной */
.btn-primary svg {
    color: var(--accent);
}

/* Надпись внутри кнопки генерации — белая */
.btn-primary .generate-btn-text {
    color: #ffffff;
}

.generate-btn-text {
    position: relative;
    z-index: 2;
    transition: color 0.2s ease;
}

/* Надпись «Генерация» не меняет цвет — остаётся как у кнопки */
.generate-btn-text.generating {
    color: inherit;
}
.generation-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    background: rgba(0, 80, 55, 0.92);
    transition: width 0.3s ease, opacity 0.2s ease;
    z-index: 1;
    border-radius: 8px;
}

/* После успешной генерации — заливка исчезает за 1 с (opacity 100% → 1%) */
.generation-progress-fill.fade-out {
    opacity: 0.01;
    transition: opacity 1s ease;
}
/* Анимация загрузки — три пульсирующие точки в кнопке генерации */
.generate-btn-loading {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 2;
}

.generate-btn-dot {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffffff;
    opacity: 0.35;
    animation: generateBtnDotPulse 1.4s ease-in-out infinite;
}

.generate-btn-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.generate-btn-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes generateBtnDotPulse {

    0%,
    80%,
    100% {
        opacity: 0.4;
        transform: scale(1);
    }

    40% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* ── Voice Changer: блок прогресса генерации ── */
.vc-generation-progress {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vc-meta-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.vc-meta-item {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.3;
}

.vc-progress-track {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 99px;
    overflow: hidden;
}

.vc-generation-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    border-radius: 99px;
    background: linear-gradient(90deg, #1db954 0%, #17a34a 60%, #1db954 100%);
    background-size: 200% 100%;
    transition: width 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Shimmer — работает пока на баре есть класс .indeterminate */
.vc-generation-bar.indeterminate {
    width: 100% !important;
    animation: vc-shimmer 1.6s linear infinite;
}

@keyframes vc-shimmer {
    0% {
        background-position: 200% center;
    }

    100% {
        background-position: -200% center;
    }
}

.vc-progress-status {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    min-height: 18px;
    transition: opacity 0.2s ease;
}
/* Айтем истории в статусе «генерируется» */
.history-item.vc-pending .history-item-actions {
    opacity: 0.4;
    pointer-events: none;
}

.history-item.vc-pending .history-text::after {
    content: ' ⏳';
}

/* Раздел Видео */
.video-generation-section .section-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 1rem;
}

.video-ratio-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.video-ratio-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: var(--bg-tertiary);
    transition: border-color 0.2s, background 0.2s;
}

.video-ratio-option:hover {
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.video-ratio-option input {
    margin: 0;
}

.video-ratio-option input:checked+span {
    font-weight: 600;
    color: var(--accent);
}

.video-result {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

.video-result-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.video-result-player {
    max-width: 100%;
    border-radius: 8px;
    background: var(--bg-tertiary);
    margin-bottom: 12px;
}

.video-download-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.video-error {
    margin-top: 1rem;
    padding: 12px;
    border-radius: 8px;
    background: rgba(200, 60, 60, 0.15);
    color: var(--text-primary);
    font-size: 14px;
}

.video-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

/* UpScale (админ) */
#upscale-section .section-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 1rem;
}

.upscale-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 2px dashed var(--border-light);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.02);
    min-height: 120px;
    text-align: center;
    position: relative;
}

.upscale-upload-zone.highlight {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.05);
}

.upscale-upload-hint {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.upscale-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.upscale-file-name {
    color: var(--text-secondary);
    font-size: 14px;
}

.upscale-model-select {
    width: 100%;
    max-width: 480px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.upscale-actions-row {
    margin-top: 16px;
}

.upscale-status,
.upscale-error {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
}

.upscale-error {
    background: rgba(255, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.upscale-result {
    margin-top: 16px;
}

.upscale-result-label {
    margin-bottom: 8px;
    font-weight: 500;
}

/* Прогресс-бар апскейла видео */
.upscale-progress {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
}

.upscale-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.upscale-progress-bar-bg {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.08));
    overflow: hidden;
}

.upscale-progress-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--accent, #6c5ce7), var(--accent-hover, #a29bfe));
    transition: width 0.4s ease;
}

.upscale-progress-details {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

#video-generate-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.video-btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: video-spin 0.8s linear infinite;
}

#video-generate-btn:not(.video-generating) .video-btn-spinner {
    display: none !important;
}

@keyframes video-spin {
    to {
        transform: rotate(360deg);
    }
}

.video-history-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.video-history-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.video-history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.video-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

.video-history-item video {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 6px;
}

.video-history-item-info {
    flex: 1;
    min-width: 0;
}

.video-history-item-prompt {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-history-item-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.video-history-item-actions a {
    margin-left: 8px;
    font-size: 13px;
}

.btn-primary:hover {
    background: #1a1b1e;
    border-color: var(--accent);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
    text-shadow: none;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--primary);
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-text:hover {
    color: var(--accent);
    opacity: 0.8;
}

/* Audio Player */
.audio-player {
    margin-top: 20px;
}

.custom-audio-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.custom-play-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.custom-play-btn:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
    transform: scale(1.05);
}

.custom-play-btn:active {
    transform: scale(0.95);
}

.custom-play-btn.playing {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.custom-audio-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-audio-progress-container {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    cursor: pointer;
    overflow: hidden;
}

.custom-audio-progress-bar {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
}

.custom-audio-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
    will-change: width;
    transition: width 0.1s linear;
}
.custom-audio-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.history-bottom-player {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%) translateY(18px) scale(0.96);
    width: min(1180px, calc(100% - 24px));
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 12px;
    box-shadow: none;
    z-index: 48;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.28s ease, opacity 0.28s ease;
}

.history-bottom-player.is-visible {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.history-bottom-btn,
.history-bottom-close {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 8px;
    border: 1px solid #2a2b2e;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-bottom-btn:hover,
.history-bottom-close:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.history-bottom-close:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.history-bottom-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.history-bottom-play {
    border-color: rgba(0, 255, 136, 0.45);
}

.history-bottom-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-bottom-title {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-bottom-progress-bar {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 999px;
    overflow: visible;
    cursor: pointer;
}

.history-bottom-progress-bar::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -20px;
    bottom: -20px;
}

.history-bottom-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
    transition: width 0.08s linear;
}

.history-bottom-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

.custom-download-btn {
    flex-shrink: 0;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

#audio-element {
    display: none;
}

/* История генераций — ниже выпадающих списков моделей и голосов */
.history-section {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    position: relative;
    z-index: 1;
    overflow: visible;
}

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

.history-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-history-action {
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-history-action:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
}

.history-item-checkbox-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    margin: -10px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.history-item-checkbox-wrap:hover {
    opacity: 0.9;
}

.history-item-checkbox {
    width: 18px;
    height: 18px;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    display: inline-grid;
    place-content: center;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.history-item-checkbox::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: #ffffff;
    transform: scale(0);
    transition: transform 0.16s ease;
}

.history-item-checkbox:hover {
    border-color: #ffffff;
}

.history-item-checkbox:checked {
    border-color: #ffffff;
    background: rgba(0, 255, 136, 0.08);
}

.history-item-checkbox:checked::after {
    transform: scale(1);
}

.history-item-checkbox:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.2);
}

@keyframes selectItem {
    0% {
        transform: scale(0.98);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.005);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes deselectItem {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(0.99);
    }

    100% {
        transform: scale(1);
        opacity: 0.95;
    }
}

@keyframes fadeOutSlide {
    0% {
        opacity: 1;
        transform: translateX(0);
        max-height: 200px;
        margin-bottom: 12px;
    }

    100% {
        opacity: 0;
        transform: translateX(-20px);
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
}

.history-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-text {
    font-size: 14px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.82;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.btn-download-all {
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.btn-download-all:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.2);
}

.btn-history-clear {
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 8px;
    color: #ff4444;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.btn-history-clear:hover {
    background: rgba(255, 68, 68, 0.1);
    border-color: #ff4444;
    color: #ff6666;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.2);
}
/* Icon-only buttons (no text label) for history actions */
.btn-download-all.btn-icon-only,
.btn-history-clear.btn-icon-only {
    padding: 8px;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    box-sizing: border-box;
    justify-content: center;
}

.btn-download-all.btn-icon-only svg,
.btn-history-clear.btn-icon-only svg {
    width: 18px;
    height: 18px;
}

/* Gray select/deselect buttons */
.btn-history-action-gray {
    color: var(--text-secondary);
    border-color: var(--border-light);
    background: var(--bg-tertiary);
}

.btn-history-action-gray:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
    background: var(--bg-secondary);
}

.history-list {
    display: grid;
    gap: 12px;
    overflow: visible;
    padding: 2px;
    margin: -2px;
}

.user-profile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 9999px;
    /* rounded-full */
    background: transparent;
    border: 1px solid #1f2937;
    /* border border-border-dark */
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    /* Prevent nested image overflow */
}

.user-profile img {
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    /* w-8 h-8 rounded-full */
    object-fit: cover;
}

.user-profile:hover {
    border-color: rgba(0, 255, 136, 0.5);
    /* hover:border-primary/50 */
}

.user-profile:active {
    transform: scale(0.95);
    /* active:scale-95 */
}

.user-profile:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.2);
    /* focus:ring-2 focus:ring-primary/20 */
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.95;
    gap: 12px;
    position: relative;
    overflow: visible;
    min-height: 84px;
    contain: layout style;
}

.history-item:hover {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.1);
    opacity: 1;
}

.history-item.is-now-playing {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 0 10px rgba(0, 255, 136, 0.1);
    opacity: 1;
}

.history-item:has(.history-item-checkbox:checked),
.history-item.selected {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.05);
    box-shadow: 0 0 0 1px var(--accent), 0 2px 8px rgba(0, 255, 136, 0.15);
    opacity: 1;
    transform: scale(1);
}

.history-item:has(.history-item-checkbox:checked):hover,
.history-item.selected:hover {
    box-shadow: 0 0 0 1px var(--accent), 0 2px 8px rgba(0, 255, 136, 0.15);
}

.history-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-item-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.history-item-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.history-item-date {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.75;
}

.history-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-item-group .ui-group-header {
    padding: 8px 10px;
}

.history-item-actions audio {
    height: 30px;
    width: 200px;
}

.history-audio-player {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 200px;
}

.history-play-btn {
    width: 40px;
    height: 40px;
    padding: 5px 8px;
    border-radius: 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    color: #fff;
    position: relative;
    box-sizing: border-box;
}

.history-play-icon {
    display: inline-block;
    line-height: 1;
    transform: translateX(0);
    font-size: 14px;
}

.history-play-btn:hover {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.06);
    color: var(--accent);
}

.history-play-btn.playing {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.12);
    color: var(--accent);
}
.history-audio-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-progress-container {
    width: 100%;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.history-progress-bar {
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.history-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.history-time {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    gap: 4px;
}

.history-download-btn {
    padding: 6px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    color: var(--accent);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.4s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.history-download-btn:hover {
    border-color: var(--accent);
}

.history-download-btn-play-like {
    width: 40px;
    height: 40px;
    padding: 5px 8px;
    border-radius: 6px;
    justify-content: center;
    gap: 0;
    color: #fff;
    box-sizing: border-box;
    flex-shrink: 0;
}

.history-download-btn-play-like:hover {
    background: rgba(0, 255, 136, 0.06);
    color: var(--accent);
}
/* History file pill buttons (MP3 / SRT) */
.history-file-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 40px;
    padding: 5px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--accent);
}

.history-file-pill:hover {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.06);
}

.history-file-pill .pill-icon {
    font-size: 14px;
    line-height: 1;
}

.history-file-pill .pill-icon svg,
.history-file-pill .pill-icon img {
    width: 14px;
    height: 14px;
}

.history-file-pill .pill-label {
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.history-file-pill.srt-generate {
    color: var(--text-secondary);
    border-style: dashed;
}

.history-file-pill.srt-generate:hover {
    color: var(--accent);
    border-color: var(--accent);
    border-style: solid;
}

.history-file-pill:disabled,
.history-file-pill[disabled] {
    opacity: 0.5;
    pointer-events: none;
}
/* Accounts List */
.accounts-list {
    display: grid;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.account-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px 16px;
    align-items: center;
    transition: all 0.4s ease;
}

.account-item:hover {
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.account-line {
    font-size: 0.95rem;
    color: var(--text-primary);
    word-break: break-word;
}

.account-email {
    font-weight: 500;
    color: var(--text-primary);
}

.account-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.account-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid var(--border-light);
}

.badge-tokens {
    background: rgba(0, 255, 136, 0.15);
    color: var(--accent);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.badge-voices {
    background: rgba(0, 255, 136, 0.15);
    color: var(--accent);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

/* Status Bar */
.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
    padding: 12px 24px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    z-index: 100;
    display: none;
    /* Скрыт по умолчанию */
}

.status-bar.success {
    color: var(--accent);
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}

.status-bar.error {
    color: var(--error);
}

.status-bar.warning {
    color: var(--warning);
}

/* Notifications Container — поверх всех слоёв (модалки, блюр) */
.notifications-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2147483647;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.notification {
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 16px 20px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    animation: slideInRight 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification.success {
    border-color: var(--success);
    background: rgba(10, 10, 10, 0.95);
}

.notification.error {
    border-color: var(--error);
    background: rgba(10, 10, 10, 0.95);
}

.notification.warning {
    border-color: var(--warning);
    background: rgba(10, 10, 10, 0.95);
}

.notification-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notification-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.notification-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.notification-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    opacity: 1;
}

.notification-action-btn {
    margin-top: 12px;
    padding: 8px 16px;
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
    width: 100%;
}

.notification-action-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.notification-action-btn:active {
    transform: scale(0.98);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.hiding {
    animation: slideOutRight 0.3s ease-in forwards;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


.variations-container {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.variations-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.variations-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.variations-row {
    display: flex;
    gap: 16px;
    width: 100%;
}

@media (max-width: 768px) {
    .variations-row {
        flex-direction: column;
    }
}

.variation-item {
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    flex: 1;
    min-width: 0;
}

.variation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.variation-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.variation-badge {
    padding: 4px 8px;
    background: var(--accent);
    color: var(--bg-primary);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.variation-audio {
    width: 100%;
    margin-bottom: 12px;
}

.variation-custom-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    margin-bottom: 12px;
}

.variation-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    position: relative;
    min-height: 36px;
}

.variation-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
}

.variation-play-btn:hover {
    border-color: var(--accent);
    background: var(--bg-secondary);
    transform: scale(1.05);
}

.variation-play-btn.playing {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-primary);
}

.variation-play-btn svg {
    width: 16px;
    height: 16px;
}

.variation-waveform {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 32px;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.variation-waveform.active {
    opacity: 1;
}

.variation-waveform .waveform-bar {
    width: 3px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.variation-waveform.active .waveform-bar {
    background: var(--accent);
    animation: waveform 1.2s ease-in-out infinite;
}

.variation-waveform.active .waveform-bar:nth-child(1) {
    animation-delay: 0s;
    height: 12px;
}

.variation-waveform.active .waveform-bar:nth-child(2) {
    animation-delay: 0.1s;
    height: 20px;
}

.variation-waveform.active .waveform-bar:nth-child(3) {
    animation-delay: 0.2s;
    height: 16px;
}

.variation-waveform.active .waveform-bar:nth-child(4) {
    animation-delay: 0.3s;
    height: 24px;
}

.variation-waveform.active .waveform-bar:nth-child(5) {
    animation-delay: 0.4s;
    height: 14px;
}

.variation-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    overflow: hidden;
    border-radius: 0 0 8px 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.variation-item:hover .variation-progress-container,
.variation-item.playing .variation-progress-container {
    opacity: 1;
    pointer-events: auto;
}

.variation-progress-container-inline {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: height 0.2s ease;
}

.variation-progress-container-inline:hover {
    height: 6px;
}

.variation-progress-bar {
    width: 100%;
    height: 100%;
    background: var(--bg-tertiary);
    position: relative;
    cursor: pointer;
    transition: height 0.2s ease;
}

.variation-progress-bar:hover {
    height: 4px;
}

.variation-progress-container-inline .variation-progress-bar {
    background: transparent;
}

.variation-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.1s linear;
    box-shadow: 0 0 4px rgba(0, 255, 136, 0.5);
    pointer-events: none;
}

.variation-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.variation-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.regenerate-btn {
    font-size: 14px;
    padding: 8px 16px;
}

.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .sliders-group {
        grid-template-columns: 1fr;
    }

    .header-content {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .header-content .logo {
        justify-self: unset;
        flex-shrink: 0;
    }

    .header-content .header-controls {
        justify-self: unset;
        flex-shrink: 0;
        margin-left: 0;
    }

    .header-content .header-tokens-wrapper {
        justify-self: unset;
        flex-shrink: 0;
        margin-left: 0;
    }

    .header-left {
        display: flex;
        align-items: center;
        flex-shrink: 0;
        min-width: 0;
    }

    .header-controls {
        flex-wrap: nowrap;
    }

    .header-content .header-login-btn,
    .header-content .btn-google.header-login-btn,
    .header-content a.btn-google#google-login-link-btn {
        padding: 0 10px;
        height: 36px;
        font-size: 13px;
    }

    .header-content .header-buy-tokens-btn {
        padding: 0 10px;
        height: 36px;
        font-size: 13px;
    }

    .header-content .header-buy-tokens-btn span {
        display: none;
    }

    .header-content .header-user-tokens {
        font-size: 13px;
        padding: 6px 10px;
    }

    .user-profile .header-user-email,
    .user-profile .profile-dropdown-arrow {
        display: none;
    }

    .user-profile {
        padding: 8px 10px;
        min-width: auto;
    }

    .account-item {
        grid-template-columns: 1fr;
    }

    .model-controls-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .model-controls-wrapper .select-wrapper {
        width: 100%;
    }

    .model-controls-wrapper #v2-variations-option {
        width: 100%;
    }

    .payment-modal-overlay {
        padding: 10px;
    }

    .payment-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 12px;
    }

    .payment-packages-container,
    .payment-methods-container {
        padding: 16px;
    }

    .payment-tokens-note {
        padding: 10px 16px;
        margin-bottom: 12px;
        font-size: 12px;
    }

    .payment-package {
        padding: 12px 8px;
        border-radius: 8px;
    }

    .payment-package-name {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .payment-package-tokens {
        font-size: 12px;
        margin-bottom: 8px;
    }

    .payment-package-price {
        font-size: 18px;
        margin-bottom: 4px;
    }

    .payment-package-price-per-token {
        font-size: 10px;
        margin-bottom: 4px;
    }

    .payment-package-note {
        font-size: 9px;
        margin-bottom: 8px;
    }

    .payment-packages-container .payment-btn {
        margin-top: 16px;
        padding: 10px 20px;
        font-size: 14px;
    }

    .payment-modal-header {
        padding: 14px 16px;
    }

    .payment-modal-title {
        font-size: 18px;
    }

    .payment-methods {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .payment-method {
        padding: 12px 8px;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 8px;
    }

    .payment-method-icon {
        width: 32px;
        height: 32px;
        margin-bottom: 4px;
    }

    .payment-method-content {
        flex: none;
        width: 100%;
    }

    .payment-method-title {
        font-size: 13px;
        margin-bottom: 2px;
    }

    .payment-method-description {
        font-size: 10px;
        line-height: 1.2;
    }

    .payment-method-arrow {
        display: none;
        /* Скрываем стрелку на мобильных для компактности */
    }

    .payment-modal .payment-status {
        margin: 0 16px 16px 16px;
        padding: 10px;
    }
}

/* Profile Modal: по центру экрана (viewport), не контейнера */
.profile-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    pointer-events: none;
}

.profile-modal-overlay .profile-modal {
    pointer-events: auto;
}

/* Блюр на весь экран (viewport) */
.profile-modal-backdrop {
    position: fixed;
    inset: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    background: rgba(0, 0, 0, 0);
    pointer-events: auto;
    z-index: 9999;
}

.profile-modal-overlay:not(.closing) .profile-modal-backdrop {
    animation: paymentBackdropBlurIn 1s ease-out forwards;
}


@keyframes backdropBlurIn {
    from {
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
        background: rgba(0, 0, 0, 0);
    }

    to {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        background: rgba(0, 0, 0, 0.5);
    }
}

.profile-modal-overlay.closing .profile-modal-backdrop {
    animation: paymentBackdropBlurOut 1s ease-out forwards;
}

@keyframes backdropBlurOut {
    from {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        background: rgba(0, 0, 0, 0.5);
    }

    to {
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
        background: rgba(0, 0, 0, 0);
    }
}

@keyframes profileModalIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes profileModalOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.96);
    }
}

.profile-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 0;
    max-width: 400px;
    width: 100%;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
    position: relative;
    z-index: 10000;
}

.profile-modal.closing {
    animation: slideDown 0.4s ease-out forwards;
}

.profile-modal-overlay.closing {
    animation: fadeOut 0.4s ease-out forwards;
}

.profile-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-light);
    gap: 16px;
}

.profile-modal-back {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-right: auto;
}

.profile-modal-back:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.profile-modal-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.profile-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.profile-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.profile-modal-content {
    padding: 8px;
}

/* Реферальная программа: модальное окно */
.referral-modal-content {
    padding: 24px 32px 32px;
}

.referral-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.referral-description strong {
    color: var(--accent);
}

.referral-link-block {
    margin-bottom: 20px;
}

.referral-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.referral-link-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.referral-link-input {
    flex: 1;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
}

.referral-copy-btn {
    flex-shrink: 0;
}

.referral-referred-block {
    margin-bottom: 12px;
}

.referral-referred-count {
    font-weight: 600;
    color: var(--accent);
    font-size: 18px;
}

.referral-referred-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.referral-earnings-block {
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.referral-earnings-value {
    font-weight: 600;
    color: var(--accent);
    font-size: 18px;
}

/* Админ: список реферальных выплат */
.referral-payouts-title {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.referral-payouts-list {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
}

/* Админ: приглашено по рефералке */
.referral-invites-block {
    padding: 12px 0;
}

.referral-invites-title {
    font-size: 16px;
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.referral-invites-total {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.referral-invites-list {
    margin: 0;
    padding-left: 20px;
    font-size: 14px;
    color: var(--text-primary);
}

.referral-invites-list li {
    margin-bottom: 4px;
}

.referral-payout-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
    gap: 16px;
}

.referral-payout-row:last-child {
    border-bottom: none;
}

.referral-payout-email {
    font-size: 14px;
    color: var(--text-primary);
}

.referral-payout-amount {
    font-weight: 600;
    color: var(--accent);
}

.referral-payout-paid {
    font-size: 12px;
    color: var(--text-secondary);
}

.referral-payout-actions {
    flex-shrink: 0;
}

/* Админ: кастомный процент и проверка по email */
.referral-custom-title {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.referral-custom-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
}

.referral-custom-form label {
    font-size: 14px;
    color: var(--text-secondary);
}

.referral-custom-form input[type="email"],
.referral-custom-form input[type="number"] {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    min-width: 180px;
}

.referral-custom-form .btn-secondary {
    flex-shrink: 0;
}

.referral-stats-result p {
    margin: 6px 0;
    font-size: 14px;
    color: var(--text-primary);
}

.referral-stats-result strong {
    color: var(--text-secondary);
    margin-right: 8px;
}

/* Разделы под шапкой: Аудио, Фото, Видео, YouTube — минималистично на всю ширину */
/* Навигация (вкладки) */
.section-nav {
    display: flex;
    align-items: center;
    gap: 32px;
}

.section-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9ca3af;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s ease-in-out, border-color 0.15s ease-in-out;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    cursor: pointer;
    border-radius: 0;
}

.section-nav-btn:hover {
    color: #f1f5f9;
    border-bottom-color: #9ca3af;
    background: transparent;
}

.section-nav-btn.active {
    color: #00ff88;
    border-bottom-color: #00ff88;
    background: transparent;
}

.section-nav-icon {
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-nav-btn .section-nav-label {
    line-height: 1.2;
}

/* Убираем отступ навигации когда активен раздел фото */
/* Убираем отступы навигации когда активен раздел фото */
body.section-photo .section-nav,
body.section-photo .header .section-nav {
    margin-top: 0;
    margin-bottom: 0;
}

body.section-photo .header .section-nav-btn {
    min-height: 0;
    padding: 8px 16px;
    font-size: 14px;
}

/* Блокируем прокрутку страницы в разделе Фото — скролл только внутри чата.
   overflow блокируется ТОЛЬКО на html — любой overflow на body (hidden или clip)
   ограничивает position:fixed потомков в большинстве браузеров. */
html:has(body.section-photo) {
    overflow: hidden;
    height: 100%;
}

body.section-photo {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    /* окно одного размера, без прокрутки страницы */
}

body.section-photo .main-content {
    margin-top: 20px;
    /* зазор под хедером (container.paddingTop задаётся в JS); не убирать при открытии модалки «Файлы» */
    padding-top: 0;
    margin-bottom: 0;
}

body.section-photo .header {
    margin-bottom: 0;
    border-bottom: 1px solid var(--border-light);
}


@media (max-width: 768px) {
    html:has(body.section-photo) {
        overflow: hidden;
        height: 100%;
    }

    body.section-photo {
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
        overflow-x: hidden;
    }

    .section-nav {
        margin: 16px auto 0;
        width: 90%;
        gap: 0;
        justify-content: space-between;
    }

    .section-nav-btn {
        flex: 1 1 0;
        min-height: 64px;
        padding: 12px 6px;
        font-size: 13px;
        gap: 6px;
    }

    .section-nav-btn .section-nav-icon svg {
        width: 18px;
        height: 18px;
    }

    /* Адаптация боковой панели для мобильных */
    .main-content {
        flex-direction: column;
        margin-top: 10px;
        /* мобильные: headerTop 0 + зазор 20px */
    }

    .main-sidebar {
        width: 100%;
        min-width: 0;
        padding-right: 0;
        margin-bottom: 20px;
    }

    .main-tabs {
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
        padding-right: 0;
        padding-bottom: 0;
        margin-bottom: 0;
    }

    .main-tab {
        flex: 1;
        text-align: center;
        margin-right: 0;
        margin-bottom: 0;
    }

    .main-tab.active {
        border-color: var(--accent);
    }
}

.section-panel-placeholder {
    padding: 48px 24px;
    text-align: center;
}

.section-placeholder-text {
    color: var(--text-secondary);
    font-size: 16px;
    margin: 0;
}

/* Main Content - контейнер с боковой панелью и контентом */
.main-content {
    width: 100%;
    /* 100% относительно контейнера = calc(100% - 40px) относительно viewport (как у хедера) */
    max-width: 1160px;
    margin: 0 auto;
    margin-top: 20px;
    /* Ровно 20px расстояние от нижней границы хедера */
    contain: layout style;
    /* Предотвращает сдвиги layout */
    min-height: calc(100vh - 100px);
    /* Резервируем место заранее */
    padding: 0;
    /* Убираем все padding */
    position: relative;
    display: block;
    box-sizing: border-box;
    transition: none !important;
    /* Убираем любые transition для margin */
}

.section-panel {
    width: 100%;
    contain: layout style;
    /* Предотвращает сдвиги layout */
    padding: 0;
    margin: 0;
    overflow: visible;
}

/* Карточка должна занимать всю ширину section-panel */
.section-panel>.card,
.section-panel>.tab-panel>.card,
.tab-panel>.card {
    width: 100%;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
}

.tab-panel {
    width: 100%;
    padding: 0;
    margin: 0;
}

/* Вкладки: Генератор / Библиотека голосов (горизонтальные кнопки сверху) */
.main-tabs {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-top: 0;
    margin-bottom: 8px;
    padding: 0;
    border: none;
    background: transparent;
}

.main-tab {
    padding: 8px 14px;
    background: rgba(18, 20, 34, 0.62);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    position: relative;
    flex: 0 0 auto;
    justify-content: center;
}

/* Иконки вкладок скрыты — сразу отображается только текст, как после загрузки */
.main-tab-icon {
    display: none;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.main-tab-text {
    display: inline-block;
    opacity: 1;
    max-width: none;
    overflow: visible;
    white-space: nowrap;
    margin-left: 0;
}

.main-tab:hover {
    background: rgba(31, 28, 52, 0.74);
    border-color: rgba(151, 156, 184, 0.24);
}

.main-tab.active {
    color: #fff;
    background: rgba(35, 28, 60, 0.78);
    border-color: var(--accent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.main-tab.active .main-tab-icon {
    color: var(--accent);
}

.main-tab:active {
    transform: translateY(0);
}

.tab-panel {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
}

/* Библиотека голосов (вкладка) */
.voice-library-section {
    padding: 24px;
    overflow: visible;
    position: relative;
}

.voice-library-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 8px;
    padding-right: 48px;
    position: relative;
    z-index: 2;
}

.voice-library-section .section-tour-help[data-section="voice-library"] {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 3;
}

@media (max-width: 768px) {
    .voice-library-section .section-tour-help[data-section="voice-library"] {
        display: none !important;
    }
}

.voice-changer-section .section-tour-help[data-section="voice-changer"] {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 3;
}

.voice-library-toolbar:has(.voice-library-filter-dropdown.show) {
    z-index: 1000000;
    position: relative;
    overflow: visible;
}

.voice-library-toolbar::-webkit-scrollbar {
    height: 6px;
}

.voice-library-toolbar::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.voice-library-toolbar::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.voice-library-toolbar::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.voice-library-search-wrap,
.voice-library-sort,
.voice-library-language-wrap,
.voice-library-filter-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
    min-width: 100px;
    max-width: 140px;
    z-index: 1;
}

.voice-library-search-wrap {
    flex: 0 0 auto;
    max-width: 180px;
}

.voice-library-search-wrap .voice-library-filter-input {
    width: 100%;
}

.voice-library-search-wrap label,
.voice-library-sort label,
.voice-library-language-wrap label,
.voice-library-filter-wrap label {
    margin-right: 0;
    margin-bottom: 0;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    display: block;
}

.voice-library-language-select {
    min-width: 140px;
}

.voice-library-accent-select {
    min-width: 120px;
}

.voice-library-select-hidden {
    display: none !important;
}

.voice-library-filter-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    z-index: 999999;
    width: 100%;
}

.voice-library-filter-wrapper:has(.voice-library-filter-dropdown.show) {
    z-index: 10000000 !important;
}

.voice-library-filter-input {
    flex: 1;
    padding: 8px 32px 8px 10px;
    cursor: pointer;
    font-size: 12px;
}

.voice-library-filter-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.voice-library-filter-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 32px;
    background: transparent;
    border: none;
    border-left: 1px solid var(--border-light);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s ease;
    border-radius: 0 8px 8px 0;
}

.voice-library-filter-btn svg {
    width: 12px;
    height: 12px;
}

.voice-library-filter-btn:hover {
    background: var(--bg-primary);
    color: var(--accent);
}

.voice-library-filter-btn.active {
    background: var(--bg-primary);
    color: var(--accent);
}

.voice-library-filter-btn.active svg {
    transform: rotate(180deg);
}

.voice-library-filter-btn svg {
    transition: transform 0.4s ease;
}

.voice-library-filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    min-height: 60px;
    max-height: calc(100vh - 20px);
    /* Будет переопределено через JS для точного расчета */
    overflow-y: auto;
    z-index: 9999999 !important;
    display: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.voice-library-filter-dropdown.show {
    display: block;
}

.voice-library-filter-dropdown-content {
    padding: 4px;
}

.voice-library-refresh-admin {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 12px;
    padding: 8px 12px;
}

.voice-library-filter-item {
    padding: 8px 10px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 12px;
    transition: all 0.4s ease;
    border-radius: 6px;
    margin-bottom: 4px;
    position: relative;
}

.voice-library-filter-item:hover {
    background: var(--bg-secondary);
    color: #fff;
}

.voice-library-filter-item.active {
    background: var(--bg-secondary);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.voice-library-filter-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 0 3px 3px 0;
}

.voice-library-sort:has(.voice-library-filter-dropdown.show),
.voice-library-language-wrap:has(.voice-library-filter-dropdown.show),
.voice-library-filter-wrap:has(.voice-library-filter-dropdown.show) {
    z-index: 10000000 !important;
    position: relative;
}

.voice-library-select {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.4s ease;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.voice-library-select:hover {
    border-color: var(--accent);
    background-color: var(--bg-secondary);
}

.voice-library-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.2), 0 0 20px rgba(0, 255, 136, 0.1);
}

.voice-library-select option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 10px 14px;
}

.voice-library-loading {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
}

.voice-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    position: relative;
    z-index: -1;
}

.voice-library-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 16px;
    transition: border-color 0.2s;
    min-height: 160px;
    position: relative;
    overflow: hidden;
    z-index: -1;
}

.voice-library-card:hover {
    border-color: var(--border);
}

.voice-library-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    flex-shrink: 0;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.voice-library-card-header .voice-favorite-btn {
    padding: 4px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
}

.voice-library-card-header .voice-favorite-btn:hover,
.voice-library-card-header .voice-favorite-btn.active {
    color: var(--accent);
}

.voice-library-card-header .voice-favorite-btn.active svg {
    fill: var(--accent);
    stroke: var(--accent);
}

.voice-library-card-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.voice-library-card-tag {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    color: var(--text-secondary);
}

.voice-library-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    min-height: 2.8em;
    flex-shrink: 0;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.voice-library-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    flex-shrink: 0;
    margin-top: auto;
}

.voice-library-card-actions .btn-secondary {
    flex: 1;
    font-size: 13px;
}

.voice-library-card-actions .voice-preview-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
}

.voice-library-card-actions .voice-preview-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.voice-library-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

/* Кастомный плеер для библиотеки голосов */
.voice-library-card-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    position: relative;
    min-height: 36px;
}

.voice-library-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
}

.voice-library-play-btn:hover {
    border-color: var(--accent);
    background: var(--bg-secondary);
    transform: scale(1.05);
}

.voice-library-play-btn.playing {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-primary);
}

.voice-library-play-btn svg {
    width: 16px;
    height: 16px;
}

.voice-library-waveform {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 32px;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.voice-library-waveform.active {
    opacity: 1;
}

.waveform-bar {
    width: 3px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.voice-library-waveform.active .waveform-bar {
    background: var(--accent);
    animation: waveform 1.2s ease-in-out infinite;
}

.voice-library-waveform.active .waveform-bar:nth-child(1) {
    animation-delay: 0s;
    height: 12px;
}

.voice-library-waveform.active .waveform-bar:nth-child(2) {
    animation-delay: 0.1s;
    height: 20px;
}

.voice-library-waveform.active .waveform-bar:nth-child(3) {
    animation-delay: 0.2s;
    height: 16px;
}

.voice-library-waveform.active .waveform-bar:nth-child(4) {
    animation-delay: 0.3s;
    height: 24px;
}

.voice-library-waveform.active .waveform-bar:nth-child(5) {
    animation-delay: 0.4s;
    height: 14px;
}

@keyframes waveform {

    0%,
    100% {
        transform: scaleY(0.5);
        opacity: 0.7;
    }

    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

.voice-library-card-player {
    position: relative;
}

.voice-library-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    overflow: hidden;
    border-radius: 0 0 12px 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.voice-library-card:hover .voice-library-progress-container,
.voice-library-play-btn.playing~.voice-library-waveform~.voice-library-progress-container {
    opacity: 1;
}

.voice-library-play-btn.playing~.voice-library-waveform~.voice-library-progress-container {
    opacity: 1;
}

.voice-library-progress-bar {
    width: 100%;
    height: 100%;
    background: var(--bg-tertiary);
    position: relative;
}

.voice-library-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.1s linear;
    box-shadow: 0 0 4px rgba(0, 255, 136, 0.5);
}

.voice-library-pagination {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    padding: 16px 0;
    border-top: 1px solid var(--border-color);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.voice-library-pagination-info {
    color: var(--text-secondary);
    font-size: 14px;
}

.voice-library-pagination-btns {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}

.voice-library-pagination-btns .voice-library-page-btn {
    min-width: 36px;
    padding: 8px 12px;
    font-size: 14px;
}

.voice-library-pagination-btns .voice-library-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.voice-library-pagination-btns .voice-library-page-btn.voice-library-page-active {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.voice-library-page-dots {
    padding: 8px 4px;
    color: var(--text-secondary);
    font-size: 14px;
}

@media (max-width: 768px) {
    .voice-library-pagination {
        gap: 8px;
        padding: 12px 0;
    }

    .voice-library-pagination-info {
        display: none;
    }

    .voice-library-pagination-btns {
        width: 100%;
        justify-content: center;
        gap: 6px;
    }

    .voice-library-pagination-btns .voice-library-page-btn {
        min-width: 34px;
        padding: 8px 10px;
        font-size: 13px;
    }

    .voice-library-page-dots {
        padding: 8px 2px;
    }
}

.profile-modal-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.profile-modal-item:hover {
    background: var(--bg-tertiary);
}

.profile-modal-item .profile-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.profile-modal-item .profile-item-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.profile-modal-item .profile-item-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.profile-modal-item .profile-item-value {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 400;
}

.profile-modal-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}

.profile-modal-item-logout {
    color: var(--error);
}

/* Кнопки «Добавить аккаунт» в профиле — по умолчанию видны; JS скрывает при привязанном аккаунте */
#profile-modal-connect-google-item,
#profile-modal-connect-telegram-item {
    display: flex;
}

.profile-connect-link {
    color: var(--accent, #48c8a0);
    text-decoration: none;
}

.profile-connect-link:hover {
    text-decoration: underline;
}

.profile-modal-item-logout:hover {
    background: rgba(255, 68, 68, 0.1);
    color: var(--error);
}

.profile-modal-support-wrap {
    cursor: pointer;
}

.profile-support-toggle {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.profile-support-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 16px;
    margin: 0 16px 8px;
    background: var(--bg-tertiary);
    border-radius: 10px;
}

.profile-support-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: background 0.2s, color 0.2s;
}

.profile-support-link:hover {
    background: var(--accent);
    color: white;
}

.profile-support-link .support-icon {
    width: 24px;
    height: 24px;
}

/* Payment Modal: по центру экрана (viewport), весь фон блюрится */
.payment-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    pointer-events: none;
}

.payment-modal-overlay .payment-modal-backdrop {
    position: fixed;
    inset: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    background: rgba(0, 0, 0, 0);
    pointer-events: auto;
    z-index: 9999;
}


@keyframes paymentBackdropBlurIn {
    from {
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
        background: rgba(0, 0, 0, 0);
    }

    to {
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        background: rgba(0, 0, 0, 0.55);
    }
}

.payment-modal-overlay.closing .payment-modal-backdrop {
    animation: paymentBackdropBlurOut 1s ease-out forwards;
}

@keyframes paymentBackdropBlurOut {
    from {
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        background: rgba(0, 0, 0, 0.55);
    }

    to {
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
        background: rgba(0, 0, 0, 0);
    }
}

.payment-modal-overlay .payment-modal {
    position: relative;
    pointer-events: auto;
    margin: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(20px);
        opacity: 0;
    }
}

.payment-modal-overlay.closing {
    animation: fadeOut 0.4s ease-out forwards;
}

.payment-modal.closing {
    animation: slideDown 0.4s ease-out forwards;
}

@keyframes tokenCountUp {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes tokenValuePulse {

    0%,
    100% {
        color: var(--text-primary);
    }

    50% {
        color: var(--accent);
        text-shadow: 0 0 10px rgba(var(--accent-rgb, 0, 230, 153), 0.5);
    }
}

.header-user-tokens.animating {
    animation: tokenCountUp 0.8s ease-out;
}

.header-user-tokens .tokens-value.updating,
#header-tokens-value.updating {
    animation: tokenValuePulse 1s ease-out;
    transition: color 0.3s ease;
}

.payment-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 0;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
    position: relative;
    z-index: 10000;
}

@keyframes slideUp {
    from {
        transform: translateY(48px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.payment-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-light);
    gap: 16px;
}

.payment-modal-back {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-right: auto;
}

.payment-modal-back:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.payment-modal-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.payment-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.payment-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.payment-packages-container {
    padding: 32px;
}

.payment-packages-container .payment-btn {
    margin-top: 24px;
}

.payment-tokens-note {
    text-align: center;
    padding: 16px 24px;
    margin-bottom: 24px;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--accent);
    border-radius: 8px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 500;
}

.payment-modal .payment-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.payment-methods-container {
    padding: 32px;
}

.payment-methods {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Мобильная версия: 2 способа оплаты в ряд */
@media (max-width: 768px) {
    .payment-methods {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

.payment-method {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.payment-method:hover {
    border-color: var(--accent);
    background: var(--bg-primary);
    transform: translateX(4px);
}

/* На мобильных устройствах убираем горизонтальный сдвиг при hover */
@media (max-width: 768px) {
    .payment-method:hover {
        transform: translateY(-2px);
    }
}

.payment-method-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    color: var(--accent);
    flex-shrink: 0;
}

.payment-method-content {
    flex: 1;
}

.payment-method-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.payment-method-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.payment-method-arrow {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.payment-method:hover .payment-method-arrow {
    color: var(--accent);
}

.payment-modal .payment-status {
    margin: 0 32px 32px 32px;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}


/* Payment Section (legacy, скрыта) */
.payment-section {
    margin-top: 20px;
    display: none !important;
}

.payment-modal .payment-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 32px;
}

.payment-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.payment-packages-loading,
.payment-packages-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px 16px;
    color: var(--text-secondary);
}

.payment-packages-error-text {
    margin: 0 0 16px;
    font-size: 15px;
}

.payment-retry-btn {
    padding: 10px 24px;
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.payment-retry-btn:hover:not(:disabled) {
    opacity: 0.9;
}

.payment-retry-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.payment-package {
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.payment-package:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.2);
}

.payment-package.selected {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.1);
}

.payment-package-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.payment-package-tokens {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.payment-package-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.payment-package-price-per-token {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 400;
    opacity: 0.8;
}

.payment-package-discount-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(238, 90, 111, 0.4);
    z-index: 10;
}

.payment-package-discount-badge span {
    line-height: 1;
}

.payment-package-note {
    font-size: 11px;
    color: var(--accent);
    margin-bottom: 16px;
    font-style: italic;
}

.payment-btn {
    width: 100%;
    padding: 12px 24px;
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.payment-btn:hover {
    background: #00e699;
    transform: scale(1.02);
}

.payment-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.payment-modal .payment-status {
    margin: 0 32px 32px 32px;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.payment-status {
    margin-top: 20px;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.payment-status.success {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--accent);
    color: var(--accent);
}

.payment-status.error {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid #ff4444;
    color: #ff4444;
}

.payment-status.info {
    background: rgba(0, 170, 255, 0.1);
}

/* Coming Soon Badge */
.coming-soon-badge {
    display: inline-block;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    opacity: 0.7;
}

.payment-method-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
}

.payment-method-disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    pointer-events: none;
}

.payment-method-disabled:hover {
    transform: none;
    border-color: var(--border-light);
}

/* Crypto Networks */
.crypto-networks-container {
    padding: 24px 32px;
}

.crypto-networks-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.crypto-networks-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.crypto-network {
    flex: 0 0 calc((100% - 24px) / 3);
    /* 3 колонки: 2 промежутка по 12px */
    padding: 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.crypto-network:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

.crypto-network-icon {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.crypto-network-name {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.crypto-network-tokens {
    font-size: 12px;
    color: var(--text-tertiary);
    opacity: 0.8;
    font-weight: 500;
}

/* Crypto Payment Info */
.crypto-payment-info {
    padding: 24px 32px;
}

.crypto-payment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.crypto-payment-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.crypto-payment-timer {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    font-family: 'Courier New', monospace;
}

.crypto-payment-timer.warning {
    color: #ffaa00;
}

.crypto-payment-timer.expired {
    color: #ff4444;
}

.crypto-payment-amount,
.crypto-payment-address,
.crypto-payment-network {
    margin-bottom: 20px;
}

.crypto-payment-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.crypto-payment-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}

.crypto-payment-address {
    position: relative;
}

.crypto-payment-address-value {
    font-size: 14px;
    font-family: 'Courier New', monospace;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: 6px;
    word-break: break-all;
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
}

.crypto-copy-btn {
    position: absolute;
    top: 0;
    right: 0;
    padding: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--accent);
    cursor: pointer;
    transition: all 0.3s ease;
}

.crypto-copy-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}

.crypto-payment-network-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.crypto-payment-warning {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid rgba(255, 170, 0, 0.3);
    border-radius: 6px;
    margin-bottom: 20px;
    color: #ffaa00;
    font-size: 13px;
    line-height: 1.5;
}

.crypto-payment-warning svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.crypto-payment-support {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
}

.support-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.support-link:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    color: var(--accent);
    transform: scale(1.1);
}

.crypto-payment-status {
    text-align: center;
    padding: 16px;
}

.crypto-payment-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: #ffebee;
    border: 2px solid #f44336;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 20px;
    color: #c62828;
    font-weight: 600;
    font-size: 15px;
    box-shadow: 0 2px 4px rgba(244, 67, 54, 0.1);
}

.crypto-payment-warning svg {
    flex-shrink: 0;
    color: #f44336;
    width: 20px;
    height: 20px;
}

.crypto-payment-status-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.crypto-payment-status.success {
    color: var(--accent);
    font-weight: 600;
}

.crypto-payment-status.error {
    color: #ff4444;
}

@media (max-width: 768px) {
    .crypto-networks-grid {
        justify-content: center;
    }

    .crypto-network {
        flex: 0 0 calc((100% - 12px) / 2);
        /* 2 колонки на узком экране */
    }
}



@media (max-width: 768px) {
    .payment-packages {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .payment-package {
        padding: 14px 10px;
    }

    .payment-package-name {
        font-size: 15px;
        margin-bottom: 4px;
    }

    .payment-package-tokens {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .payment-package-price {
        font-size: 20px;
        margin-bottom: 4px;
    }
}

/* Регулятор громкости: на ПК — справа от логотипа в шапке, на мобильных — перетаскиваемый fixed */
.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    user-select: none;
    margin: 0;
    align-self: center;
}

/* ПК: в потоке шапки, справа от логотипа, без обводки; ручка «6 точек» скрыта */
@media (min-width: 769px) {
    .header-left .volume-control {
        position: static;
        left: auto;
        top: auto;
        right: auto;
        bottom: auto;
        z-index: 1;
        border: none;
        box-shadow: none;
        margin-left: 16px;
    }

    .header-left .volume-control .volume-control__grip {
        display: none;
    }
}

/* Мобильные: регулятор громкости скрыт */
@media (max-width: 768px) {
    .volume-control {
        display: none !important;
    }
}

.volume-control__grip {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: default;
    touch-action: none;
    opacity: 0.6;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Ccircle cx='9' cy='6' r='1.5'/%3E%3Ccircle cx='15' cy='6' r='1.5'/%3E%3Ccircle cx='9' cy='12' r='1.5'/%3E%3Ccircle cx='15' cy='12' r='1.5'/%3E%3Ccircle cx='9' cy='18' r='1.5'/%3E%3Ccircle cx='15' cy='18' r='1.5'/%3E%3C/svg%3E") center/contain no-repeat;
}

.volume-control__grip:active {
    cursor: default;
}

.volume-control:active .volume-control__grip {
    cursor: default;
}

.volume-control__label {
    display: flex;
    align-items: center;
    cursor: default;
    touch-action: none;
    color: var(--text-secondary);
}

.volume-control__label:active {
    cursor: default;
}

.volume-control__icon {
    flex-shrink: 0;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 3px;
    align-self: flex-start;
}

.volume-control__slider {
    width: 90px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
    margin: 0;
}

.volume-control__slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    outline: none;
    box-shadow: 0 0 16px rgba(168, 115, 255, 0.55);
}

.volume-control__slider::-webkit-slider-thumb:hover {
    outline: none;
    box-shadow: none;
}

.volume-control__slider::-webkit-slider-thumb:focus {
    outline: none;
    box-shadow: none;
}

.volume-control__slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    outline: none;
    box-shadow: none;
}

.volume-control__slider::-moz-range-thumb:hover {
    outline: none;
    box-shadow: none;
}

.volume-control__slider::-moz-range-thumb:focus {
    outline: none;
    box-shadow: none;
}
/* Адаптация для мобильных (414×896, 430×932 и уже) */
@media (max-width: 480px) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .container {
        padding: 12px 16px;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .header {
        width: 100%;
        left: 0;
        transform: none;
        padding-top: 10px;
        padding-bottom: 10px;
        padding-left: 16px;
        padding-right: 16px;
        margin-bottom: 0;
        border-radius: 0;
        border-top: 1px solid var(--border-light);
        top: 0;
        /* На мобильных хедер прижат к верху */
    }

    .header-content {
        gap: 12px;
        grid-template-columns: 1fr;
        justify-items: center;
        justify-content: center;
    }

    .header-left {
        justify-self: center;
    }

    .header-content .header-controls {
        justify-self: center;
        margin-left: 0;
    }

    .header-content .header-tokens-wrapper {
        justify-self: center;
        margin-left: 0;
    }

    .logo {
        display: none;
        /* Скрываем логотип на мобильных */
    }

    .volume-control {
        padding: 8px 10px;
        gap: 8px;
    }

    .volume-control__slider {
        width: 72px;
    }

    .card {
        padding: 16px 20px;
        margin-bottom: 16px;
        border-radius: 10px;
    }

    .section-title {
        font-size: 18px;
        margin-bottom: 16px;
    }

    .section-header {
        margin-bottom: 16px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .form-row {
        gap: 16px;
    }

    .textarea-input {
        min-height: 72px;
        padding: 10px 14px;
        font-size: 16px;
    }

    .select-input,
    .voice-input,
    .model-input {
        padding: 10px 14px;
        font-size: 16px;
        min-height: 44px;
    }

    .btn-primary,
    .btn-secondary {
        min-height: 48px;
        padding: 12px 20px;
        font-size: 15px;
    }

    /* Адаптация вкладок для мобильных */
    .main-content {
        width: 100%;
        /* Совпадает с шириной хедера на мобильных */
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .main-tabs {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        margin-bottom: 16px;
    }

    .main-tab {
        min-width: 0;
        padding: 8px 6px;
        font-size: 12px;
        line-height: 1.15;
        flex: 1 1 auto;
        white-space: normal;
        text-align: center;
        justify-content: center;
        align-items: center;
    }

    .main-tab-text {
        display: block;
        text-align: center;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .main-tab-icon {
        width: 16px;
        height: 16px;
    }

    .sliders-group {
        gap: 16px;
        margin: 16px 0;
    }

    .slider-group label {
        font-size: 13px;
    }

    .voice-library-section {
        padding: 16px;
    }

    .voice-library-section .section-tour-help[data-section="voice-library"] {
        display: none;
    }

    .voice-library-toolbar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        gap: 10px;
        margin-bottom: 16px;
        overflow: visible;
        padding: 0;
    }

    .voice-library-section .section-tour-help[data-section="voice-library"] {
        top: 16px;
        right: 16px;
        width: 32px;
        height: 32px;
    }

    .voice-changer-section .section-tour-help[data-section="voice-changer"] {
        top: 16px;
        right: 16px;
        width: 32px;
        height: 32px;
    }

    .voice-library-search-wrap {
        max-width: none;
        min-width: 0;
    }

    .voice-library-search-wrap,
    .voice-library-sort,
    .voice-library-language-wrap,
    .voice-library-filter-wrap {
        min-width: 0;
        max-width: none;
        width: 100%;
        gap: 4px;
    }

    .voice-library-search-wrap label,
    .voice-library-sort label,
    .voice-library-language-wrap label,
    .voice-library-filter-wrap label {
        font-size: 12px;
        margin-bottom: 0;
    }

    .voice-library-filter-wrapper {
        width: 100%;
    }

    .voice-library-filter-input {
        padding: 10px 34px 10px 10px;
        font-size: 13px;
        padding-right: 32px;
        min-height: 42px;
    }

    .voice-library-filter-btn {
        width: 32px;
    }

    .voice-library-filter-btn svg {
        width: 12px;
        height: 12px;
    }

    .voice-library-filter-dropdown {
        font-size: 13px;
        max-height: min(52vh, 320px);
    }

    .voice-library-filter-item {
        padding: 10px;
        font-size: 13px;
    }

    .voice-library-refresh-admin {
        flex-shrink: 0;
        white-space: nowrap;
        font-size: 12px;
        padding: 8px 12px;
    }

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

    .voice-library-card {
        padding: 14px;
    }

    .audio-player,
    .custom-audio-player {
        padding: 12px;
    }

    .custom-audio-controls {
        min-width: 0;
    }

    .history-bottom-player {
        bottom: max(10px, env(safe-area-inset-bottom));
        width: calc(100% - 16px);
        padding: 8px 10px;
        gap: 8px;
    }

    .history-bottom-btn,
    .history-bottom-close {
        width: 30px;
        height: 30px;
        min-width: 30px;
    }

    .history-section {
        padding: 0;
    }

    .history-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .history-header-actions {
        flex-wrap: wrap;
    }

    .history-item {
        padding: 12px;
        gap: 10px;
        min-height: 72px;
    }

    .history-item-content {
        min-width: 0;
    }

    .history-text {
        font-size: 13px;
    }

    .status-bar {
        padding: 8px 16px;
        font-size: 12px;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .notifications-container {
        left: 16px;
        right: 16px;
        bottom: max(16px, env(safe-area-inset-bottom));
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .debug-console {
        left: 8px;
        right: 8px;
        bottom: 8px;
        max-height: 50vh;
    }

    .debug-console-toggle {
        bottom: max(16px, env(safe-area-inset-bottom));
        right: 16px;
    }
}

.payment-modal-overlay,
.profile-modal-overlay {
    padding: 8px;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.payment-modal,
.profile-modal {
    max-height: 90vh;
    border-radius: 10px;
}

.payment-modal-header,
.profile-modal-header {
    padding: 14px 16px;
}

.payment-modal-title,
.profile-modal-title {
    font-size: 18px;
}

/* Компактное модальное окно оплаты для мобильных */
.payment-packages-container {
    padding: 16px;
}

.payment-tokens-note {
    padding: 10px 16px;
    margin-bottom: 12px;
    font-size: 12px;
}

.payment-modal .payment-packages {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0;
}

.payment-package {
    padding: 12px 8px;
    border-radius: 8px;
}

.payment-package-name {
    font-size: 14px;
    margin-bottom: 4px;
}

.payment-package-tokens {
    font-size: 12px;
    margin-bottom: 8px;
}

.payment-package-price {
    font-size: 18px;
    margin-bottom: 4px;
}

.payment-package-price-per-token {
    font-size: 10px;
    margin-bottom: 4px;
}

.payment-package-note {
    font-size: 9px;
    margin-bottom: 8px;
}

.payment-packages-container .payment-btn {
    margin-top: 16px;
    padding: 10px 20px;
    font-size: 14px;
}

.variations-container {
    padding: 16px;
}

.variation-item {
    padding: 12px;
}

.remove-pauses-zone {
    flex-wrap: wrap;
}

.header-controls {
    flex-wrap: nowrap;
}

.header-tokens-wrapper {
    flex-shrink: 0;
}

.user-profile {
    max-width: 100%;
}
}

/* ==================== Debug Console (для отладки в Telegram Mini App) ==================== */
.debug-console {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-height: 60vh;
    background: rgba(10, 10, 10, 0.98);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.debug-console-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-light);
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    color: var(--text-primary);
}

.debug-console-btn {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    margin-left: 8px;
    transition: background 0.2s;
}

.debug-console-btn:hover {
    background: var(--bg-secondary);
}

.debug-console-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    color: var(--text-primary);
    max-height: calc(60vh - 40px);
}

.debug-console-content::-webkit-scrollbar {
    width: 6px;
}

.debug-console-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.debug-console-content::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.debug-log-entry {
    margin-bottom: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    word-break: break-all;
    white-space: pre-wrap;
    font-size: 11px;
    line-height: 1.4;
}

.debug-log-entry.log {
    background: rgba(0, 255, 136, 0.1);
    color: var(--success);
}

.debug-log-entry.error {
    background: rgba(255, 68, 68, 0.1);
    color: var(--error);
}

.debug-log-entry.warn {
    background: rgba(255, 170, 0, 0.1);
    color: var(--warning);
}

.debug-log-entry.info {
    background: rgba(68, 136, 255, 0.1);
    color: #4488ff;
}

.debug-log-time {
    color: var(--text-secondary);
    font-size: 10px;
    margin-right: 8px;
}

.debug-console-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 255, 136, 0.2);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 18px;
    cursor: pointer;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    transition: background 0.2s, transform 0.2s;
}

.debug-console-toggle:hover {
    background: rgba(0, 255, 136, 0.3);
    transform: scale(1.1);
}

.debug-console-toggle.active {
    background: var(--accent);
    color: var(--bg-primary);
}

@media (max-width: 480px) {
    .debug-console {
        left: 8px;
        right: 8px;
        bottom: 8px;
        max-height: 50vh;
    }

    .debug-console-toggle {
        bottom: max(16px, env(safe-area-inset-bottom));
        right: 16px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

/* ==================== Раздел Фото (Photo Section) ==================== */
#section-panel-photo {
    overflow: visible;
    /* даём дропдаунам выходить за пределы панели */
    height: calc(100vh - 140px);
    padding: 0;
    margin-top: 0;
    display: flex;
    flex-direction: column;
}

.photo-unified-window {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: 0;
    border: none;
    border-top: 1px solid var(--border-light);
    overflow: visible;
    /* не обрезаем выпадающие списки внутри */
    margin-top: 0;
}

/* Когда активен раздел фото: фиксированная высота, прокрутка только внутри чата (как в ChatGPT) */
body.section-photo #section-panel-photo {
    margin-top: 0;
    padding-top: 0;
    height: calc(100vh - 140px);
    max-height: calc(100vh - 140px);
    overflow: hidden;
    min-height: 0;
}

/* Контент раздела Фото занимает всю высоту панели и не растягивает окно */
body.section-photo #section-panel-photo #photo-section-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

body.section-photo .photo-unified-window {
    flex: 1;
    min-height: 0;
    border-top: none;
    margin-top: 0;
    border-radius: 16px;
    overflow: hidden;
}

.photo-chat {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
    /* не обрезаем дропдауны «Соотношение сторон» и «Количество» */
    position: relative;
}

.photo-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

.photo-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.photo-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.photo-chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

.photo-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.photo-chat-msg {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    max-width: 80%;
}

.photo-chat-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.photo-chat-msg.assistant {
    align-self: flex-start;
}

.photo-chat-bubble {
    background: #161618;
    border-radius: 12px;
    padding: 8px 14px;
    border: 1px solid #252528;
}

@property --photo-border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

.photo-chat-msg.assistant .photo-chat-bubble {
    position: relative;
    border-color: transparent;
}

.photo-chat-msg.assistant .photo-chat-bubble::before {
    content: '';
    position: absolute;
    inset: -1px;
    z-index: -1;
    border-radius: 12px;
    padding: 1px;
    background: conic-gradient(from var(--photo-border-angle), #252528 0%, #252528 35%, rgba(255, 255, 255, 0.35) 50%, #252528 65%, #252528 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: photoBorderRotate 3s linear infinite;
}

@keyframes photoBorderRotate {
    to {
        --photo-border-angle: 360deg;
    }
}

/* Сообщения бота с картинками и анимация загрузки — без фона и анимации обводки */
.photo-chat-msg.assistant .photo-chat-bubble:has(.photo-chat-image-row),
.photo-chat-bubble:has(.photo-chat-loading) {
    padding: 0;
    border: none;
    background: transparent;
}

.photo-chat-msg.assistant .photo-chat-bubble:has(.photo-chat-image-row)::before,
.photo-chat-bubble:has(.photo-chat-loading)::before {
    display: none;
}

.photo-chat-msg.user .photo-chat-bubble {
    background: #1e1e21;
    color: #e0e0e0;
    border-color: #2e2e32;
    padding: 8px 14px;
}

.photo-chat-text {
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
    word-wrap: break-word;
}

/* Анимация загрузки — три пульсирующие точки */
.photo-chat-loading {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.photo-chat-dot {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffffff;
    opacity: 0.35;
    animation: photoChatDotPulse 1.4s ease-in-out infinite;
}

.photo-chat-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.photo-chat-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes photoChatDotPulse {

    0%,
    80%,
    100% {
        opacity: 0.4;
        transform: scale(1);
    }

    40% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Ряд: превью фото + кнопка «Ответить» справа */
.photo-chat-image-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

/* Альбом из нескольких фото (сетка 2 колонки) */
.photo-chat-image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-width: 100%;
}

.photo-chat-image-grid .photo-chat-image-wrap {
    margin-top: 0;
    max-width: 100%;
}

.photo-chat-image-grid .photo-chat-image-wrap img {
    max-width: 100%;
    height: auto;
}

/* Несколько фото — по ширине как одиночное (380px), сетка по количеству */
.photo-chat-image-grid--multiple {
    gap: 8px;
    max-width: 380px;
}

/* 2 фото — один ряд из 2 */
.photo-chat-image-grid--multiple.photo-chat-image-grid--count-2 {
    grid-template-columns: repeat(2, 1fr);
}

/* 3 фото — один ряд из 3 */
.photo-chat-image-grid--multiple.photo-chat-image-grid--count-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* 4 и больше — 2 столбца (квадрат 2×2 для 4 фото) */
.photo-chat-image-grid--multiple.photo-chat-image-grid--count-4,
.photo-chat-image-grid--multiple.photo-chat-image-grid--count-5,
.photo-chat-image-grid--multiple.photo-chat-image-grid--count-6,
.photo-chat-image-grid--multiple.photo-chat-image-grid--count-7,
.photo-chat-image-grid--multiple.photo-chat-image-grid--count-8,
.photo-chat-image-grid--multiple.photo-chat-image-grid--count-9,
.photo-chat-image-grid--multiple.photo-chat-image-grid--count-10 {
    grid-template-columns: repeat(2, 1fr);
}

.photo-chat-image-grid--multiple .photo-chat-image-wrap {
    max-width: 100%;
    aspect-ratio: 1;
    min-height: 0;
}

.photo-chat-image-grid--multiple .photo-chat-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.photo-chat-reply-btn--on-image {
    position: absolute;
    top: 8px;
    right: 38px;
    left: auto;
    width: 28px;
    height: 28px;
    min-height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.28);
    border: none;
    color: #fff;
    z-index: 2;
    padding: 0;
    margin: 0;
    line-height: 0;
    transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.photo-chat-reply-btn--on-image:hover {
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    opacity: 1;
    transform: none;
}

.photo-chat-reply-btn--on-image svg {
    width: 14px;
    height: 14px;
}

.photo-chat-download-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    min-height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
    z-index: 2;
    padding: 0;
    margin: 0;
    line-height: 0;
    transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.photo-chat-download-btn:hover {
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    opacity: 1;
}

.photo-chat-download-btn svg {
    width: 14px;
    height: 14px;
}

.photo-chat-image-wrap {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
    max-width: 380px;
    max-height: 380px;
}

.photo-chat-image-wrap:hover {
    transform: none;
}

.photo-chat-image-wrap img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 380px;
    max-height: 380px;
    object-fit: contain;
    border-radius: 8px;
    vertical-align: middle;
}

.photo-chat-input-wrap {
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    min-height: fit-content;
}

/* Полоска «Ответ на изображение» над полем ввода — по ширине содержимого */
.photo-reply-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 12px;
    width: fit-content;
    max-width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

.photo-reply-bar-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.photo-reply-bar-thumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.photo-reply-bar-thumb-wrap {
    position: relative;
    flex-shrink: 0;
}

.photo-reply-bar-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    display: block;
}

.photo-reply-bar-thumb-remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.photo-reply-bar-thumb-remove:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.photo-reply-bar-cancel {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.photo-reply-bar-cancel:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* Кнопка «Ответить» справа от фото */
.photo-chat-reply-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}

.photo-chat-reply-btn:hover {
    background: var(--bg-primary);
    color: var(--accent);
    border-color: var(--accent);
    transform: scale(1.05);
}

.photo-chat-reply-btn svg {
    flex-shrink: 0;
}

.photo-chat-reply-btn.photo-chat-reply-btn--on-image {
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    background: rgba(0, 0, 0, 0.28);
    border: none;
    color: #fff;
    top: 8px;
    line-height: 0;
    align-items: center;
    justify-content: center;
    transform: none;
}

.photo-chat-reply-btn.photo-chat-reply-btn--on-image:hover {
    background: rgba(0, 0, 0, 0.45);
    border: none;
    color: #fff;
    transform: none;
}

.photo-chat-reply-btn.photo-chat-reply-btn--on-image svg {
    width: 14px;
    height: 14px;
}

.photo-controls-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.photo-controls-row .form-group {
    margin-bottom: 0;
}

/* Единая планка ввода в стиле сайта: прикрепление + поле + отправка */
.photo-chat-input-row {
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
    min-height: 52px;
    padding: 4px 4px 4px 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 26px;
}

.photo-attach-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    min-height: 36px;
    margin: 0;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    box-sizing: border-box;
}

.photo-attach-btn svg {
    width: 18px;
    height: 18px;
}

.photo-attach-btn:hover {
    color: #fff;
    background: var(--bg-tertiary);
}

.photo-attach-input-hidden {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.photo-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.photo-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.photo-empty-text {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.photo-empty-hint {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Обводка drag-and-drop по всему контейнеру: вкладки + область чата + панель ввода */
#photo-section-content.photo-drag-over {
    position: relative;
}

#photo-section-content.photo-drag-over::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px dashed var(--accent);
    border-radius: 12px;
    background: rgba(0, 255, 136, 0.06);
    pointer-events: none;
    z-index: 100;
}

.photo-chat-input {
    flex: 1;
    height: 44px;
    min-height: 44px;
    padding: 12px 12px 12px 4px;
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    transition: none;
    overflow-y: hidden;
    max-height: 200px;
    box-sizing: border-box;
}

.photo-chat-input:focus {
    outline: none;
}

.photo-chat-input.scrollable {
    overflow-y: auto;
    max-height: 200px;
}

.photo-chat-input::placeholder {
    color: var(--text-secondary);
}

.photo-send-btn {
    width: 32px;
    height: 32px;
    min-height: 32px;
    margin: 0;
    align-self: center;
    background: #ffffff;
    border: none;
    border-radius: 50%;
    color: #000000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
    flex-shrink: 0;
    box-sizing: border-box;
}

.photo-send-btn:hover {
    background: #f0f0f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.photo-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Модальное окно просмотра фото (выше модалки «Файлы», чтобы фото открывалось поверх) */
.photo-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10010;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
}

.photo-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.photo-modal-overlay.closing {
    opacity: 0;
    visibility: hidden;
}

.photo-modal-overlay.closing .photo-modal-content {
    transform: scale(0.96);
    opacity: 0;
}

.photo-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: opacity 0.25s ease;
    z-index: 0;
}

.photo-modal-content {
    position: relative;
    z-index: 10011;
    max-width: 88vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 12px;
    transform: scale(0.92);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}

.photo-modal-overlay.is-open .photo-modal-content {
    transform: scale(1);
    opacity: 1;
}

/* Строка: стрелка — контент — стрелка */
.photo-modal-content .photo-modal-image-wrap {
    flex-shrink: 0;
}

.photo-modal-main-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 0;
    position: relative;
    z-index: 1;
}

/* Обёртка для зума: фото + кнопки (скачать, закрыть, стрелки) масштабируются вместе */
.photo-modal-zoom-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transform-origin: center center;
    transition: transform 0.1s ease-out;
}

/* Контейнер фото: крестик позиционируется внутри него */
.photo-modal-image-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0;
}

.photo-modal-image-wrap img,
.photo-modal-content img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: block;
}

/* Стрелки влево/вправо — без фона, полупрозрачные, при наведении белые */
.photo-modal-arrow {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 10005;
}

.photo-modal-arrow:hover {
    color: #fff;
}

.photo-modal-arrow:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.photo-modal-arrow.hidden {
    display: none;
}

/* Полоса миниатюр внизу: на экране одновременно ровно 7 фото, остальное — прокрутка */
.photo-modal-thumbs {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    width: calc(56px * 7 + 8px * 6);
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 20;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
}

.photo-modal-thumbs.photo-modal-thumbs--centered {
    justify-content: center;
}

.photo-modal-thumb {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    min-width: 56px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s ease, opacity 0.2s ease;
    background: var(--bg-secondary);
}

.photo-modal-thumb:hover {
    opacity: 0.9;
}

.photo-modal-thumb.active {
    border-color: var(--accent);
    opacity: 1;
}

.photo-modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Кнопки закрытия и скачивания — как в чате: лёгкий квадратный затемнённый фон */
.photo-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    left: auto;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.28);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
    z-index: 10004;
    padding: 0;
    margin: 0;
}

.photo-modal-close:hover {
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
}

.photo-modal-download {
    position: absolute;
    top: 12px;
    right: 48px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
    z-index: 10004;
    transition: background 0.2s ease, color 0.2s ease;
}

.photo-modal-download:hover {
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
}

.photo-files-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.photo-files-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.photo-files-link:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
}

body.section-photo .photo-files-link {
    color: #fff;
}

body.section-photo .photo-files-link:hover {
    color: #fff;
}

.photo-files-icon {
    font-size: 18px;
}

.photo-files-icon-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.photo-files-icon-svg svg,
.photo-files-icon-svg .photo-files-icon-img {
    flex-shrink: 0;
    display: block;
}

.photo-files-icon-svg svg {
    color: inherit;
}

@keyframes phmBackdropIn {
    from {
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
        background: rgba(0, 0, 0, 0);
    }

    to {
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        background: rgba(0, 0, 0, 0.55);
    }
}

@keyframes phmBackdropOut {
    from {
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        background: rgba(0, 0, 0, 0.55);
    }

    to {
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
        background: rgba(0, 0, 0, 0);
    }
}

@keyframes phmModalIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes phmModalOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

.photo-history-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    pointer-events: none;
}

.photo-history-modal-backdrop {
    position: fixed;
    inset: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    background: rgba(0, 0, 0, 0);
    pointer-events: auto;
    z-index: 0;
}

.photo-history-modal-overlay:not(.phm-closing) .photo-history-modal-backdrop {
    animation: phmBackdropIn 0.22s ease-out forwards;
}

.photo-history-modal-overlay.phm-closing .photo-history-modal-backdrop {
    animation: phmBackdropOut 0.22s ease-out forwards;
}

.photo-history-modal {
    position: relative;
    z-index: 1;
    pointer-events: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: min(1100px, calc(100vw - 32px));
    width: 100%;
    max-height: 94vh;
    height: 94vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

.photo-history-modal-overlay:not(.phm-closing) .photo-history-modal {
    animation: phmModalIn 0.18s ease-out forwards;
}

.photo-history-modal-overlay.phm-closing .photo-history-modal {
    animation: phmModalOut 0.18s ease-out forwards;
}

.photo-history-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.photo-history-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.photo-history-modal-close {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: color 0.2s, background 0.2s;
}

.photo-history-modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.photo-history-modal-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.photo-history-modal-overlay .btn-history-action {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
}

.photo-history-modal-overlay .btn-history-action:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.12);
}

.photo-history-modal-overlay .btn-download-all.btn-icon-only {
    border: 1px solid rgba(0, 255, 136, 0.4);
    color: var(--accent);
}

.photo-history-modal-overlay .btn-download-all.btn-icon-only:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.photo-history-modal-overlay .btn-download-all.btn-icon-only,
.photo-history-modal-overlay .btn-history-clear.btn-icon-only {
    padding: 8px;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    box-sizing: border-box;
}

.photo-history-modal-overlay .btn-download-all.btn-icon-only svg,
.photo-history-modal-overlay .btn-history-clear.btn-icon-only svg {
    width: 18px;
    height: 18px;
}

.photo-history-list {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-content: flex-start;
}

.photo-history-empty {
    width: 100%;
    text-align: center;
    color: var(--text-secondary);
    padding: 48px 24px;
    margin: 0;
    font-size: 15px;
}

.photo-history-item {
    position: relative;
    width: calc((100% - 16px * 3) / 4);
    flex-shrink: 0;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    transition: border-color 0.2s, box-shadow 0.2s;
    aspect-ratio: 1;
}

.photo-history-item::before {
    content: '';
    display: block;
    padding-bottom: 100%;
}

.photo-history-item:hover {
    border-color: var(--border-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.photo-history-item:has(.history-item-checkbox:checked),
.photo-history-item.selected {
    border-color: var(--border);
    background: var(--bg-tertiary);
    box-shadow: none;
}

.photo-history-item:has(.history-item-checkbox:checked):hover,
.photo-history-item.selected:hover {
    box-shadow: none;
    border-color: var(--border-light);
}

.photo-history-thumb-wrap {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    overflow: hidden;
}

.photo-history-thumb-wrap[aria-disabled="true"] {
    cursor: default;
}

.photo-history-list .history-item-icon.photo-history-thumb {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.photo-history-list .history-item-icon.photo-history-thumb::before {
    content: '';
    display: block;
    padding-bottom: 100%;
}

.photo-history-card-download {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
    z-index: 2;
    padding: 0;
    transition: background 0.2s ease;
}

.photo-history-card-download:hover {
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
}

.photo-history-card-download svg {
    width: 14px;
    height: 14px;
}

/* Сетка превью для 2–4 фото в одном пункте */
.photo-history-thumb--grid {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    display: grid;
    gap: 2px;
    min-height: 0;
    min-width: 0;
    align-items: stretch;
    justify-items: stretch;
}

.photo-history-thumb--count-2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}

.photo-history-thumb--count-3 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr;
}

.photo-history-thumb--count-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.photo-history-thumb--grid .photo-history-thumb-cell {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.photo-history-thumb--grid .photo-history-thumb-cell .photo-history-thumb-img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    display: block;
    object-fit: cover;
    object-position: center;
}

.photo-history-thumb-img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s, opacity 0.2s;
}

.photo-history-thumb-img--lazy {
    background: var(--bg-secondary);
    opacity: 0.5;
}

.photo-history-thumb-wrap:hover .photo-history-thumb-img {
    transform: none;
}

.photo-history-thumb-wrap:hover::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.06);
    pointer-events: none;
    border-radius: inherit;
}

.photo-history-thumb-placeholder {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    opacity: 0.5;
}

.photo-history-item .history-item-checkbox-wrap {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    padding: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: none;
    transition: background 0.2s ease;
}

.photo-history-item .history-item-checkbox-wrap:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: none;
}

.photo-history-item .history-item-checkbox {
    width: 16px;
    height: 16px;
    margin: 0;
    border-radius: 50%;
    outline: none;
    border: none;
    accent-color: var(--accent);
}

.photo-history-item .history-item-checkbox:checked {
    transform: none;
}

.photo-history-item .history-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 6px 10px;
}

.photo-history-item {
    position: relative;
}

@media (max-width: 768px) {
    #section-panel-photo {
        height: calc(100vh - 140px);
    }

    #photo-section-content label[for="photo-model-select"],
    #photo-section-content label[for="photo-aspect-select"],
    #photo-section-content label[for="photo-count-select"] {
        font-size: 12px !important;
        white-space: nowrap;
    }

    #photo-model-select,
    #photo-aspect-select,
    #photo-count-select {
        font-size: 12px;
    }

    #photo-model-dropdown .model-option,
    #photo-aspect-dropdown .model-option,
    #photo-count-dropdown .model-option {
        font-size: 12px;
        padding: 8px 10px;
    }

    .photo-chat-image-wrap {
        max-width: 280px;
        max-height: 280px;
    }

    .photo-chat-image-wrap img {
        max-width: 280px;
        max-height: 280px;
    }

    .photo-chat-image-grid--multiple {
        max-width: 280px;
    }
}

/* Upscale History */
.upscale-history-section {
    border-top: 1px solid var(--border);
    padding-top: 24px;
}

.upscale-history-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.upscale-history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.upscale-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.upscale-history-item:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.upscale-history-info {
    flex: 1;
    min-width: 0;
    margin-right: 16px;
}

.upscale-history-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upscale-history-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
}

.upscale-history-model,
.upscale-history-scale {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.upscale-history-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.upscale-history-loading,
.upscale-history-empty,
.upscale-history-error {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.upscale-history-error {
    color: var(--error);
    border-color: var(--error);
}

/* Floating Buttons */
.floating-buttons {
    position: fixed;
    bottom: 24px;
    left: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}

.floating-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    padding: 0 10px;
    border-radius: 999px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: width 0.2s ease, padding 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    font-weight: 500;
    border: 1px solid var(--border-light);
    backdrop-filter: blur(10px);
    white-space: nowrap;
    overflow: hidden;
}

.floating-btn:hover,
.floating-btn:focus-visible {
    width: 168px;
    padding: 0 10px;
    border-radius: 50px;
    transform: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    border-color: var(--accent);
}

.floating-icon {
    width: 24px;
    height: 24px;
    margin-right: 0;
    flex-shrink: 0;
    transition: none;
}

.floating-text {
    font-size: 15px;
    font-weight: 600;
    margin-left: 12px;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-width 0.25s ease, opacity 0.2s ease;
    pointer-events: none;
}

.floating-btn:hover .floating-text,
.floating-btn:focus-visible .floating-text {
    max-width: 140px;
    opacity: 1;
}

.telegram-channel-btn {
    background-color: rgba(42, 171, 238, 0.1);
    border-color: rgba(42, 171, 238, 0.3);
}

.telegram-channel-btn:hover {
    background-color: rgba(42, 171, 238, 0.2);
    border-color: #2AABEE;
}

.telegram-channel-btn .floating-icon {
    color: #2AABEE;
}

.support-btn {
    background-color: rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.3);
}

.support-btn:hover {
    background-color: rgba(0, 255, 136, 0.2);
    border-color: var(--accent);
}

.support-btn .floating-icon {
    color: var(--accent);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .floating-buttons {
        display: none;
    }
}

/* ==================== Onboarding Tour ==================== */
.tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    pointer-events: auto;
    transition: opacity 0.15s ease;
}

.tour-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.tour-spotlight {
    position: fixed;
    z-index: 100001;
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.72);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.tour-spotlight-match-modal {
    border-radius: 16px;
}

.tour-spotlight-match-modal::after {
    border-radius: 18px;
    inset: -2px;
}

.tour-spotlight-no-outline::after {
    display: none;
}

.tour-spotlight-hidden {
    visibility: hidden;
    box-shadow: none;
}

.tour-spotlight::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 14px;
    border: 2px solid rgba(168, 85, 247, 0.7);
    animation: tour-pulse 2s ease-in-out infinite;
}

@keyframes tour-pulse {

    0%,
    100% {
        border-color: rgba(168, 85, 247, 0.7);
        box-shadow: 0 0 12px rgba(168, 85, 247, 0.25);
    }

    50% {
        border-color: rgba(168, 85, 247, 1);
        box-shadow: 0 0 24px rgba(168, 85, 247, 0.5);
    }
}

.tour-tooltip {
    position: fixed;
    z-index: 100002;
    left: 16px !important;
    top: 50% !important;
    bottom: auto !important;
    right: auto !important;
    transform: translateY(calc(-50% + 6px));
    background: var(--card-bg, #1e1e2e);
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: 16px;
    padding: 20px 24px 16px;
    width: 380px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(168, 85, 247, 0.15);
    transition: opacity 0.18s ease, transform 0.18s ease;
    opacity: 0;
    pointer-events: auto;
}

.tour-tooltip.visible {
    opacity: 1;
    transform: translateY(-50%);
}

.tour-step-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(168, 85, 247, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}

.tour-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.tour-lang-toggle {
    padding: 0;
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tour-lang-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
    user-select: none;
}

.tour-lang-toggle:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
    color: var(--accent);
}

.tour-step-badge svg {
    width: 14px;
    height: 14px;
}

.tour-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin: 0 0 6px;
    line-height: 1.3;
}

.tour-description {
    font-size: 14px;
    color: var(--text-secondary, #a0a0b0);
    line-height: 1.55;
    margin: 0 0 18px;
}

.tour-progress {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.tour-progress-dot {
    width: 100%;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
    transition: background 0.3s;
}

.tour-progress-dot.active {
    background: rgba(168, 85, 247, 0.8);
}

.tour-progress-dot.done {
    background: rgba(168, 85, 247, 0.4);
}

.tour-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tour-btn-next {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 22px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: linear-gradient(135deg, #a855f7, #7c3aed);
    color: #fff;
    transition: all 0.2s;
    white-space: nowrap;
}

.tour-btn-next:hover {
    background: linear-gradient(135deg, #b875f8, #8b5cf6);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.35);
}

.tour-btn-next:active {
    transform: translateY(0);
}

.tour-btn-skip {
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: transparent;
    color: var(--text-secondary, #a0a0b0);
    transition: all 0.2s;
    white-space: nowrap;
}

.tour-btn-skip:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary, #fff);
}

/* Tour choice menu */
.tour-choice-overlay {
    position: fixed;
    inset: 0;
    z-index: 100010;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.tour-choice-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.tour-choice-dialog {
    background: var(--card-bg, #1e1e2e);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 16px;
    padding: 28px 28px 22px;
    max-width: 360px;
    width: calc(100vw - 32px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    transform: scale(0.92);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tour-choice-overlay.visible .tour-choice-dialog {
    transform: scale(1);
}

.tour-choice-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin: 0 0 18px;
    text-align: center;
    line-height: 1.4;
}

.tour-choice-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tour-choice-btn {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.tour-choice-btn.primary {
    background: linear-gradient(135deg, #a855f7, #7c3aed);
    color: #fff;
}

.tour-choice-btn.primary:hover {
    background: linear-gradient(135deg, #b875f8, #8b5cf6);
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.35);
    transform: translateY(-1px);
}

.tour-choice-btn.secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary, #fff);
}

.tour-choice-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.tour-choice-btn.ghost {
    background: transparent;
    color: var(--text-secondary, #a0a0b0);
}

.tour-choice-btn.ghost:hover {
    color: var(--text-primary, #fff);
    background: rgba(255, 255, 255, 0.04);
}
/* Tour skip confirmation dialog */
.tour-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 100010;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}

.tour-confirm-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.tour-confirm-dialog {
    background: var(--card-bg, #1e1e2e);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 16px;
    padding: 28px 32px 24px;
    max-width: 340px;
    width: calc(100vw - 32px);
    text-align: center;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    transform: scale(0.92);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tour-confirm-overlay.visible .tour-confirm-dialog {
    transform: scale(1);
}

.tour-confirm-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin: 0 0 20px;
}

.tour-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.tour-confirm-yes {
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #fff);
    transition: all 0.2s;
}

.tour-confirm-yes:hover {
    background: rgba(255, 255, 255, 0.14);
}

.tour-confirm-no {
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: linear-gradient(135deg, #a855f7, #7c3aed);
    color: #fff;
    transition: all 0.2s;
}

.tour-confirm-no:hover {
    background: linear-gradient(135deg, #b875f8, #8b5cf6);
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.35);
}

/* Highlight active audio sub-tab during tour */
.main-tab.tour-highlight-tab {
    position: relative;
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.8), 0 0 16px rgba(168, 85, 247, 0.35);
    border-radius: 8px;
    z-index: 100003;
    animation: tour-pulse 2s ease-in-out infinite;
}
/* Lock page scroll during tour (user cannot scroll, but JS can) */

/* Bring modals above tour overlay when tour is running */
body:has(.tour-overlay) .profile-modal-overlay,
body:has(.tour-overlay) .payment-modal-overlay {
    z-index: 99999 !important;
}

@media (max-width: 600px) {
    .tour-tooltip {
        width: calc(100vw - 32px);
        padding: 16px 18px 14px;
        border-radius: 14px;
    }

    .tour-title {
        font-size: 15px;
    }

    .tour-description {
        font-size: 13px;
    }

    .tour-btn-next {
        padding: 8px 18px;
        font-size: 13px;
    }

    .tour-btn-skip {
        padding: 8px 12px;
        font-size: 12px;
    }

    .tour-confirm-dialog {
        padding: 22px 20px 18px;
    }
}
/* ==================== Utility Classes (устраняем дублирование стилей) ==================== */

/* Карточка — используется в динамически созданных элементах (голоса, файлы и т.д.) */
.ui-card {
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

/* Заголовок группы (например, группы голосов в библиотеке) */
.ui-group-header {
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

/* Пустое состояние в grid (нет элементов, начальная загрузка) */
.ui-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Состояние ошибки в grid */
.ui-error-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--error);
}

/* Вспомогательный текст (в контейнерах без grid) */
.ui-helper-text {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

/* Лейбл формы (заменяет повторяющийся inline-стиль на label-элементах) */
.ui-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Список очереди */
.ui-queue-list {
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

/* Заголовок внутри очереди */
.ui-queue-title {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Элемент очереди */
.ui-queue-item {
    font-size: 14px;
    padding-left: 8px;
    border-left: 2px solid var(--text-secondary);
}

/* Кнопка-ghost (без фона/рамки, используется для иконок действий) */
.ui-btn-ghost {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    padding: 0 4px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.ui-btn-ghost:hover {
    color: var(--error);
}

@media (max-width: 768px) {
    html,
    body {
        overflow-x: hidden !important;
        overflow-y: auto;
        width: 100%;
        max-width: 100%;
    }

    .logo-icon {
        display: none;
    }

    .logo {
        display: block;
    }

    .header {
        padding-top: 3px;
        padding-bottom: 3px;
    }

    .container {
        padding-top: 110px;
    }

    .main-content {
        margin-top: 8px;
        padding-left: 2px;
        padding-right: 2px;
        box-sizing: border-box;
    }

    .main-tabs,
    .section-panel,
    .tab-panel {
        padding-left: 2px;
        padding-right: 2px;
        box-sizing: border-box;
    }

    .header-content {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "left right"
            "nav nav";
        align-items: center;
        justify-items: center;
        column-gap: 8px;
        row-gap: 6px;
    }

    .header-left {
        grid-area: left;
        justify-self: center;
        min-width: 0;
        text-align: center;
    }

    .header-right {
        grid-area: right;
        justify-self: center;
        align-self: center;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        align-items: center;
        justify-content: center;
        gap: 8px !important;
        min-width: 0;
        text-align: center;
    }

    .header-right .header-tokens-wrapper,
    .header-right .header-controls,
    .header-right .user-profile-wrapper {
        display: flex;
        align-items: center;
    }

    .header-right .header-tokens-wrapper {
        justify-self: end;
    }

    .header-right .user-profile-wrapper {
        justify-self: start;
    }

    .header-right .header-controls {
        justify-content: center;
        justify-self: center;
        width: auto;
        padding-left: 0 !important;
        margin: 0;
        border-left: none !important;
    }

    .header-right #language-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        height: 32px;
        padding: 0 6px;
    }

    .header-right .language-text {
        display: inline-flex;
        align-items: center;
        line-height: 1;
    }

    .header .section-nav {
        grid-area: nav;
        justify-self: center;
        position: static;
        left: auto;
        transform: none;
        margin-top: 0;
        width: 100%;
        max-width: none;
        margin-left: auto;
        margin-right: auto;
        display: flex;
        justify-content: stretch;
        align-items: center;
        gap: 0;
        flex-wrap: nowrap;
        overflow-x: hidden;
        padding-bottom: 2px;
    }

    .header .section-nav-btn {
        min-height: 46px;
        padding: 8px 4px;
        gap: 0;
        justify-content: center;
        align-items: center;
        flex: 1 1 25%;
        min-width: 0;
        font-size: clamp(13px, 3.8vw, 16px);
        white-space: nowrap;
        text-align: center;
    }

    body.section-photo .header .section-nav-btn {
        min-height: 46px;
        padding: 8px 4px;
        font-size: clamp(13px, 3.8vw, 16px);
    }

    .header .section-nav-btn .section-nav-label {
        width: 100%;
        text-align: center;
        overflow: visible;
        text-overflow: clip;
    }

    .header .section-nav-btn .section-nav-icon {
        margin-right: 1px;
    }

    .header .section-nav-btn .section-nav-icon svg {
        width: clamp(12px, 3.2vw, 15px);
        height: clamp(12px, 3.2vw, 15px);
    }

    .header .section-nav-btn .section-nav-icon.material-symbols-outlined {
        font-size: clamp(12px, 3.2vw, 15px);
    }
}

@media (max-width: 420px) {
    .header {
        padding-top: 2px;
        padding-bottom: 2px;
    }

    .container {
        padding-top: 106px;
    }

    .main-content {
        margin-top: 6px;
    }

    .header .section-nav {
        width: 100%;
        gap: 0;
    }

    .header .section-nav-btn {
        min-height: 44px;
        padding: 8px 2px;
        gap: 0;
        font-size: 13px;
    }

    .header .section-nav-btn .section-nav-icon {
        margin-right: 1px;
    }

    body.section-photo .header .section-nav-btn {
        min-height: 44px;
        padding: 8px 2px;
        font-size: 13px;
    }

    .header .section-nav-btn .section-nav-icon svg {
        width: 14px;
        height: 14px;
    }

    .header .section-nav-btn .section-nav-icon.material-symbols-outlined {
        font-size: 14px;
    }
}
