* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #e1e1e1, #cccccc);
    color: #2c2c2c;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #FF7E40 #eeeeee;
}

#snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -10%;
    color: white;
    font-family: Arial, sans-serif;
    user-select: none;
    animation: fall linear infinite;
}

@keyframes fall {
    to {
        transform: translateY(110vh);
    }
}


#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e1e1e1, #cccccc);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.5s ease;
}

#preloader.fade-out {
    opacity: 0;
    pointer-events: none;
}

.preloader-logo {
    width: 300px;
    height: auto;
    animation: pulse 2s infinite;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(0.95);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.button, .clear-btn, .voice-btn, .scroll-buttons .scroll-btn, .audio-output a, .model-btn, #generate-btn, #show-voices-btn, .download-btn {
    background: linear-gradient(135deg, #FF7F50, #FF6347);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: inline-block;
    text-decoration: none;
    text-align: center;
    margin: 5px;
    max-width: fit-content;
}

.button:hover, .clear-btn:hover, .voice-btn:hover, .scroll-buttons .scroll-btn:hover, 
.audio-output a:hover, .model-btn:hover, #generate-btn:hover, #show-voices-btn:hover, .download-btn:hover {
    background: linear-gradient(135deg, #FF6347, #FF7E40);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 126, 64, 0.3);
}

.button:active, .clear-btn:active, .voice-btn:active, .scroll-buttons .scroll-btn:active,
.audio-output a:active, .model-btn:active, #generate-btn:active, #show-voices-btn:active, .download-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(255, 126, 64, 0.2);
}

/* Специальные стили для маленьких кнопок */
.voice-btn, .clear-btn {
    padding: 4px 6px;
    font-size: 9px;
    min-width: 60px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 24px;
    letter-spacing: 0.3px;
}

/* Стили для кнопок моделей */
.model-btn {
    width: 100%;
    max-width: 100%;
}

.model-btn.selected {
    background: linear-gradient(135deg, #40da00, #35b500);
    box-shadow: 0 4px 15px rgba(64, 218, 0, 0.2);
}

/* Стили для кнопки генерации */
#generate-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 700;
    margin-top: 20px;
}

/* Стили для кнопок скролла */
.scroll-buttons .scroll-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    min-width: 40px;
    min-height: 40px;
}

/* Стили для кнопок загрузки */
.download-btn {
    padding: 8px 15px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.download-btn i {
    font-size: 14px;
}

.text-input-container {
    position: relative;
}

.loading-icon-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: none;
    flex-direction: column;
    align-items: center; 
    z-index: 10;
}

.loading-icon {
    width: 40px;
    height: 40px;
    background: url('/static/images/pimpochka-logo.svg') no-repeat center center;
    background-size: contain;
    animation: pulse 1.5s ease-in-out infinite;
    margin: 0 auto;
    display: none;
    opacity: 0.7;
    border: none;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.7;
    }
    100% {
        transform: scale(0.95);
        opacity: 0.5;
    }
}

.loading-status {
    margin-top: 10px;
    color: #FF7E40;
    font-size: 14px;
    font-weight: bold;
    display: none;
    text-align: center;
}

.video-title-field {
    position: relative;
    display: flex;
    align-items: center;
}

.video-title-area {
    flex: 1;
}

.link-button {
    position: absolute;
    right: -10px;
    top: 5px;
    padding: 0px;
    cursor: pointer;
    font-size: 15px;
}

.link-button.hidden {
    display: none;
}

.delete-button {
    position: absolute;
    right: -32px;
    top: 5px;
    cursor: pointer;
    font-size: 15px;
    color: #ff6347;
    background: none;
    border: none;
    padding: 0;
    transition: all 0.2s ease;
}

.delete-button:hover {
    color: #ff0000;
    transform: scale(1.2);
}

.navbar {
    background: linear-gradient(135deg, #FF7F50, #FF6347);
    padding: 12px 0;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    animation: fadeIn 0.5s ease-in-out;
    border-radius: 15px;
    margin: 10px 15px;
    backdrop-filter: blur(10px);
}

.nav-links {
    display: flex;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-links li {
    margin: 0 5px;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.15);
    letter-spacing: 0.8px;
    text-transform: uppercase;
}


.nav-links a::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -5px;
    width: 0;
    height: 2px;
    background-color: #d9d9d9;
    transition: width 0.3s ease, left 0.3s ease;
    transform: translateX(-50%);
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-links a:hover {
    background: rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-links a:active {
    transform: translateY(1px);
    background: rgba(0, 0, 0, 0.3);
}

.nav-links a i {
    font-size: 14px;
    opacity: 0.9;
}

.menu-toggle {
    display: none;
}

.container {
    display: flex;
    justify-content: space-between;
    max-width: 90vw;
    margin: 20px auto;
    gap: 20px;
    background: #FDFDFD;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.script-panel {
    flex: 0.25;
    min-width: 250px;
    order: 1;
}

.main-content {
    flex: 0.5;
    min-width: 450px;
    order: 2;
}

.settings-panel {
    flex: 0.25;
    min-width: 250px;
    order: 3;
    position: static;
    align-self: flex-start;
}

.synthesis-panel {
    flex: 0.4;
    min-width: 400px;
    order: 3;
}

.synthesis-area {
    width: 100%;
    min-height: 200px;
    font-size: 16px;
    padding: 10px;
    border: 2px solid #FF7E40;
    border-radius: 10px;
    background-color: #FFFFFF;
    color: #2c2c2c;
    resize: vertical;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    transition: border-color 0.3s;
}

.video-titles-header {
    font-size: 16px;
    margin-top: 15px;
    color: #2c2c2c;
    font-weight: bold;
    text-align: center;
}

.video-titles-header-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.video-titles-header {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.current-category {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

/* Добавляем анимацию при активном состоянии */
.category-select.category-active {
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.category-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid #FF7E40;
    background-color: white;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FF7E40' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
}

.category-select:hover {
    border-color: #FFB273;
    background-color: #fff5f0;
}

.category-select:focus {
    outline: none;
    border-color: #FF7E40;
    box-shadow: 0 0 0 3px rgba(255, 126, 64, 0.2);
}

.category-select option {
    padding: 8px;
    background-color: white;
    color: #333;
}

.category-select option:hover {
    background-color: #fff5f0;
}

.video-titles-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.video-title-area {
    width: 100%;
    min-height: 40px;
    font-size: 14px;
    padding: 8px;
    border: 2px solid #FF7E40;
    border-radius: 8px;
    background-color: #FFFFFF;
    color: #2c2c2c;
    resize: none; 
    overflow-y: hidden;
    transition: border-color 0.3s;
}

.video-title-area:focus {
    border-color: #FF7E40;
    outline: none;
}

.script-area {
    width: 100%;
    min-height: 200px;
    font-size: 16px;
    padding: 10px;
    border: 2px solid #FF7E40;
    border-radius: 10px;
    background-color: #FFFFFF;
    color: #2c2c2c;
    position: relative;
    resize: vertical;
    max-height: 250px;
    overflow: auto;
}

.script-area:focus, .synthesis-area:focus {
    border-color: #FF7E40;
    outline: none;
}

.button:hover, .clear-btn:hover, .voice-btn:hover, .scroll-buttons .scroll-btn:hover, .audio-output a:hover {
    background-color: #FFB273;
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.audio-output a:hover {
    transform: translateY(-2px);
}

.button:active, .clear-btn:active, .voice-btn:active, .scroll-buttons .scroll-btn:active, .audio-output a:active {
    background-color: #cc5b00;
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px #FF7E40, 0 0 10px #FF7E40, 0 0 15px #FF7E40;
    }
    50% {
        box-shadow: 0 0 10px #FF7E40, 0 0 20px #FF7E40, 0 0 30px #FF7E40;
    }
}

.voice-btn.selected {
    animation: glow 1.5s infinite alternate;
}

.favorite-voices {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    margin-bottom: 15px;
    justify-content: center;
    padding: 3px 0;
}

.voice-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-evenly;
    margin-bottom: 20px;
    max-height: 200px;
    overflow-y: auto;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hidden {
    display: none;
}

.script-area:empty:before {
  content: "Insert script here...";
  color: #999;
}

.voice-container.hidden {
    display: none;
}

.voice-card {
    flex: 0 1 100px;
    max-width: 100px;
    padding: 8px;
    border: 2px solid #FF7E40;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    background: #FFFFFF;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s, transform 0.3s;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

.voice-card h4 {
    font-size: 10px;
    margin-bottom: 2px;
    color: #2c2c2c;
}

.voice-card:hover {
    background-color: #FF7E40;
    color: #ffffff;
    transform: scale(1.02);
}

.voice-card.selected {
    border-color: #FF7E40;
    background-color: #40da00;
}

.selected-voice {
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    color: #ffffff;
    margin-top: 15px;
    text-align: center;
    background: linear-gradient(135deg, #FF7F50, #FF6347);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(255, 99, 71, 0.3);
    animation: fadeIn 0.5s ease-in-out;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    letter-spacing: 1px;
}

.settings {
    display: flex;
    flex-direction: column;
}

.settings label {
    font-size: 14px;
    margin-bottom: 5px;
    color: #2c2c2c;
}

.model-select-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

.slider-container {
    position: relative;
    margin-bottom: 20px;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 12px;
    border-radius: 10px;
    background: linear-gradient(90deg, #FF7E40 0%, #FFB273 100%);
    outline: none;
    transition: background 0.3s ease;
}

.slider:hover {
    background: linear-gradient(90deg, #FFB273 0%, #FF7E40 100%);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    transition: background-color 0.3s, transform 0.2s;
}

.slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    transition: background-color 0.3s, transform 0.2s;
}

.slider:active::-webkit-slider-thumb,
.slider:active::-moz-range-thumb {
    transform: scale(1.1);
}

.slider-value {
    position: absolute;
    top: -5px;
    right: 15px;
    font-size: 14px;
    color: #2c2c2c;
    display: none;
    transition: opacity 0.3s ease;
}

.slider-container:hover .slider-value {
    display: block;
}

.audio-output {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.audio-output a {
    font-size: 14px;
    color: #ffffff;
    background-color: #FF7E40;
    padding: 8px 16px;
    margin-top: 10px;
    text-decoration: none;
    border-radius: 25px;
    transition: background-color 0.3s, transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.audio-output a:hover {
    transform: translateY(-2px);
}

.audio-output a:active {
    background-color: #cc5b00;
    transform: translateY(0);
}

.translate-container {
    margin-top: 50px;
    padding: 20px;
    border-radius: 20px;
    background: #FFF1E0;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease-in-out;
}

.scroll-buttons {
    position: fixed;
    left: 10px;
    top: 50%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transform: translateY(-50%);
    z-index: 1000;
}

.scroll-buttons .scroll-btn {
    background-color: #FF7E40;
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease, transform 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
}

.scroll-buttons .scroll-btn:hover {
    background-color: #FFB273;
}

.scroll-buttons .scroll-btn:active {
    transform: scale(0.95);
}

#generate-btn {
    position: relative;
}

#generate-btn.loading {
    background-color: #FF7E40;
    pointer-events: none;
    color: #ffffff;
}

#generate-btn.loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 4px solid #ffffff;
    border-top: 4px solid #FF7E40;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

body::-webkit-scrollbar {
    width: 10px;
}

body::-webkit-scrollbar-track {
    background: #eeeeee;
    border-radius: 5px;
}

body::-webkit-scrollbar-thumb {
    background-color: #FF7E40;
    border-radius: 10px;
    border: 3px solid #eeeeee;
}

body::-webkit-scrollbar-thumb:hover {
    background-color: #FF9E66;
}

@media only screen and (min-width: 770px) and (max-width: 1004px) {
    body {
        font-size: 16px;
    }

    .navbar {
        flex-direction: row-reverse;
        align-items: center;
        padding: 20px 30px;
        justify-content: space-between;
    }

    .menu-toggle {
        display: none;
    }

    .nav-links {
        display: flex;
        gap: 15px;
    }

    .nav-links a {
        font-size: 16px;
        padding: 10px 20px;
    }

    .container {
        max-width: 90%;
        margin: 0 auto;
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
        padding: 20px;
    }

    .script-panel, .settings-panel, .main-content {
        flex: 1 1 calc(33.33% - 20px);
        min-width: 250px;
        padding: 20px;
    }

    .synthesis-panel {
        flex: 1 1 calc(60% - 20px);
        padding: 20px;
    }

    .settings-panel {
        flex: 1 1 calc(40% - 20px);
        padding: 20px;
    }

    .synthesis-area {
        font-size: 16px;
        padding: 15px;
        resize: vertical;
    }

    .voice-container {
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
        justify-content: space-evenly;
        padding: 20px 0;
    }

    .voice-card {
        flex: 0 1 calc(20% - 10px);
        max-width: calc(20% - 10px);
        padding: 10px;
    }

    .voice-card h4 {
        font-size: 14px;
        line-height: 1.3;
    }

    .favorite-voices {
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
        justify-content: center;
        padding: 10px 0;
    }

    .voice-btn {
        font-size: 12px;
        padding: 10px 15px;
        border-radius: 12px;
    }

    .button {
        font-size: 16px;
        padding: 15px;
        margin-top: 15px;
        width: 100%;
    }

    #show-voices-btn, #generate-btn {
        font-size: 16px;
        padding: 12px 20px;
        width: auto;
    }

    .slider-container label {
        font-size: 14px;
    }

    .slider {
        height: 12px;
    }

    .slider::-webkit-slider-thumb,
    .slider::-moz-range-thumb {
        width: 16px;
        height: 16px;
    }

    .audio-output a {
        font-size: 14px;
        padding: 10px 20px;
    }

    .selected-voice {
        font-size: 16px;
        text-align: center;
    }
}

/* Мобильное навигационное меню */
@media only screen and (max-width: 768px) {
    .navbar {
        position: fixed;
        width: 100%;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    
    .menu-toggle {
        display: block;
        cursor: pointer;
        padding: 15px;
        z-index: 1001;
        position: relative;
    }
    
    .menu-toggle .bar {
        width: 25px;
        height: 3px;
        background: linear-gradient(135deg, #FF7F50, #FF6347);
        margin: 5px 0;
        border-radius: 3px;
        transition: all 0.3s ease-in-out;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        height: 100vh;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding: 80px 20px 30px;
        transition: all 0.4s ease-in-out;
        z-index: 1000;
        overflow-y: auto;
    }
    
    .nav-links.active {
        left: 0;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    
    .nav-links li {
        width: 100%;
        margin: 0;
        padding: 10px 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    .nav-links li:last-child {
        border-bottom: none;
    }
    
    .nav-links a {
        display: flex;
        align-items: center;
        font-size: 16px;
        font-weight: 500;
        color: #333;
        padding: 10px 0;
        transition: all 0.3s ease;
        text-decoration: none;
        position: relative;
    }
    
    .nav-links a:hover {
        color: #FF6347;
        transform: translateX(5px);
    }
    
    .menu-toggle.active .bar:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    .menu-toggle.active .bar:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    .container {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .script-panel, .settings-panel, .main-content {
        width: 100%;
        padding: 15px;
        margin-bottom: 10px;
        order: unset;
    }

    .script-panel {
        order: 1;
    }

    .main-content {
        order: 2;
    }

    .settings-panel {
        order: 3;
    }

    .synthesis-panel {
        width: 100%;
        max-width: 100%;
        padding: 15px;
        margin: 0 auto;
        overflow-x: hidden;
    }

    .synthesis-area {
        word-wrap: break-word;
        white-space: normal;
    }

    .voice-container {
        flex-wrap: wrap;
        max-width: 100%;
        justify-content: center;
        gap: 5px;
    }

    .voice-card {
        flex: 0 1 80px;
        max-width: 80px;
        padding: 6px;
    }

    .voice-card h4 {
        font-size: 10px;
    }

    .button {
        width: 100%;
        padding: 12px;
        font-size: 14px;
        margin: 10px 0;
    }

    #show-voices-btn, #generate-btn {
        font-size: 14px;
        padding: 10px;
    }

    .slider-container label {
        font-size: 12px;
    }

    .slider {
        height: 10px;
    }

    .slider::-webkit-slider-thumb,
    .slider::-moz-range-thumb {
        width: 14px;
        height: 14px;
    }

    .audio-output {
        align-items: stretch;
    }

    .audio-output a {
        font-size: 14px;
        padding: 10px 20px;
    }

    .selected-voice {
        font-size: 14px;
        padding: 8px;
        margin-top: 10px;
        text-align: center;
    }
    .favorite-voices {
        display: flex;
        gap: 5px;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 10px 0;
        margin: 0;
    }

    .voice-btn {
        font-size: 10px;
        padding: 6px 10px;
        width: auto;
        height: auto;
        flex: 0 0 auto;
        border-radius: 8px;
    }
}

/* Для экранов менее 480px */
@media only screen and (max-width: 480px) {
    body {
        font-size: 12px;
    }

    .navbar {
        padding: 10px;
    }

    .menu-toggle {
        font-size: 20px;
    }

    .container {
        padding: 10px;
        gap: 8px;
    }

    .script-panel, .settings-panel, .main-content {
        padding: 10px;
    }

    .synthesis-panel {
        padding: 8px;
    }

    .synthesis-area {
        font-size: 12px;
        padding: 6px;
    }

    .voice-container {
        gap: 5px;
    }

    .voice-card {
        flex: 0 1 55px;
        max-width: 55px;
        padding: 4px;
    }

    .voice-card h4 {
        font-size: 8px;
    }

    .favorite-voices {
        gap: 3px;
        padding: 8px 0;
    }

    .voice-btn {
        font-size: 7px;
        padding: 4px 6px;
    }

    .button {
        font-size: 12px;
        padding: 10px;
    }

    #show-voices-btn, #generate-btn {
        font-size: 12px;
        padding: 8px;
    }

    .slider-container label {
        font-size: 10px;
    }

    .slider {
        height: 6px;
    }

    .slider::-webkit-slider-thumb,
    .slider::-moz-range-thumb {
        width: 10px;
        height: 10px;
    }

    .audio-output a {
        font-size: 10px;
        padding: 8px;
    }

    .selected-voice {
        font-size: 12px;
    }
}
@media only screen and (max-width: 350px) {
    body {
        font-size: 10px;
    }

    .navbar {
        padding: 5px;
    }

    .menu-toggle {
        font-size: 18px;
    }

    .container {
        padding: 5px;
        gap: 5px;
    }

    .script-panel, .settings-panel, .main-content {
        padding: 8px;
    }

    .synthesis-panel {
        padding: 5px;
    }

    .synthesis-area {
        font-size: 10px;
        padding: 5px;
    }

    .voice-container {
        gap: 3px;
    }

    .voice-card {
        flex: 0 1 50px;
        max-width: 50px;
        padding: 3px;
    }

    .voice-card h4 {
        font-size: 7px;
    }

    .favorite-voices {
        gap: 2px;
    }

    .voice-btn {
        font-size: 6px;
        padding: 3px 4px;
    }

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

    #show-voices-btn, #generate-btn {
        font-size: 10px;
        padding: 6px;
    }

    .slider-container label {
        font-size: 8px;
    }

    .slider {
        height: 5px;
    }

    .slider::-webkit-slider-thumb,
    .slider::-moz-range-thumb {
        width: 8px;
        height: 8px;
    }

    .audio-output a {
        font-size: 8px;
        padding: 6px;
    }

    .selected-voice {
        font-size: 10px;
    }
}

#history-container {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
    margin-top: 20px;
    scrollbar-width: thin;
    scrollbar-color: #FF7E40 #eeeeee;
}

#history-container::-webkit-scrollbar {
    width: 8px;
}

#history-container::-webkit-scrollbar-track {
    background: #eeeeee;
    border-radius: 4px;
}

#history-container::-webkit-scrollbar-thumb {
    background-color: #FF7E40;
    border-radius: 4px;
    border: 2px solid #eeeeee;
}

#history-container::-webkit-scrollbar-thumb:hover {
    background-color: #FF9E66;
}

#history-container h4 {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #FF7F50, #FF6347);
    color: white;
    padding: 8px 12px;
    margin: 0;
    z-index: 1;
    border-radius: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.audio-element {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.audio-element:hover {
    transform: translateY(-2px);
}

.audio-element audio {
    width: 100%;
    margin-bottom: 10px;
}

/* Улучшения для основного интерфейса */
.synthesis-area {
    transition: height 0.3s ease;
    min-height: 100px;
    line-height: 1.5;
}

.synthesis-area:focus {
    height: 200px;
}

.script-area:empty::before {
    content: "Insert script here...";
    color: #999;
    font-style: italic;
}

.video-title-area:focus {
    height: auto;
    min-height: 60px;
}

/* Улучшенная анимация для кнопок */
.button, .clear-btn, .voice-btn {
    position: relative;
    overflow: hidden;
}

.button::after, .clear-btn::after, .voice-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.button:focus:not(:active)::after,
.clear-btn:focus:not(:active)::after,
.voice-btn:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(100, 100);
        opacity: 0;
    }
}

/* Улучшенные стили для voice-container */
.voice-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.voice-card {
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #fff, #f8f8f8);
}

.voice-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 15px rgba(255, 126, 64, 0.2);
}

.voice-card.selected {
    background: linear-gradient(135deg, #FF7E40, #FF6347);
    color: white;
}

/* Улучшенные стили для слайдеров */
.slider-container {
    position: relative;
    padding: 10px 0;
}

.slider-container label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.slider-value {
    background: #FF7E40;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-block;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.slider-container:hover .slider-value {
    opacity: 1;
}

/* Адаптивные улучшения */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .synthesis-panel, .settings-panel {
        padding: 15px;
    }

    .voice-container {
        padding: 10px;
    }

    .voice-card {
        flex: 0 1 calc(33.33% - 10px);
    }

    #history-container {
        max-height: 250px;
    }
}

/* Улучшенная анимация загрузки */
.loading-icon {
    animation: spin 1s linear infinite, borderAnimation 2s ease infinite;
    border: none;
}

@keyframes borderAnimation {
    0% {
        opacity: 0.5;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 0.5;
    }
}

.error-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #ff4444;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.error-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.script-panel h4, .settings-panel h3 {
    text-align: center;
    margin-bottom: 15px;
    color: #2c2c2c;
}

.voice-category-header {
    padding: 10px;
    margin: 10px 0;
    background-color: #f5f5f5;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    color: #2c2c2c;
    font-size: 14px;
}

.voice-search-container {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

.voice-search-container.hidden {
    display: none;
}

.voice-search-input {
    width: 100%;
    padding: 12px 15px;
    padding-right: 40px;
    border: 2px solid #eee;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    box-sizing: border-box;
}

.voice-search-input:focus {
    outline: none;
    border-color: #FF6347;
    box-shadow: 0 0 5px rgba(255, 126, 64, 0.3);
}

.voice-search-input::placeholder {
    color: #999;
    font-style: italic;
}

.voice-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 5px;
    font-size: 18px;
    display: none;
    transition: color 0.3s ease;
}

.voice-search-clear:hover {
    color: #666;
}

.voice-search-clear.visible {
    display: block;
}

#history-container h4 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 18px;
    color: #333;
}

.synthesis-panel h3 {
    text-align: center;
    margin-bottom: 15px;
    color: #2c2c2c;
    font-size: 14px;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

h1, h2, h3, h4, h5, h6, p, span, div, button, input, textarea {
    font-family: 'Inter', sans-serif;
}

#show-voices-btn, #generate-btn {
    width: auto;
    min-width: 150px;
    font-size: 14px;
    padding: 10px 20px;
    margin: 5px;
}

.voice-buttons-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.selected-voice {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    color: #ffffff;
    margin: 10px 0;
    text-align: center;
    background: linear-gradient(135deg, #FF7F50, #FF6347);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(255, 99, 71, 0.2);
    animation: fadeIn 0.5s ease-in-out;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    letter-spacing: 0.5px;
}

/* Общие стили для скроллбаров */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #FF7F50, #FF6347);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #FF6347, #FF4500);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #FF7F50 rgba(255, 255, 255, 0.1);
}

/* Обновляем стили для конкретных элементов */
#history-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#history-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

#history-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #FF7F50, #FF6347);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

#history-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #FF6347, #FF4500);
    border: 2px solid transparent;
    background-clip: padding-box;
}

.voice-container {
    scrollbar-width: thin;
    scrollbar-color: #FF7F50 rgba(255, 255, 255, 0.1);
}

.synthesis-area, .script-area {
    scrollbar-width: thin;
    scrollbar-color: #FF7F50 rgba(255, 255, 255, 0.1);
}

/* Предотвращение скролла при открытом меню */
body.menu-open {
    overflow: hidden;
}

/* Добавляем красивую анимацию появления для ссылок меню */
@media only screen and (max-width: 768px) {
    .nav-links li {
        opacity: 0;
        transform: translateX(-20px);
        transition: all 0.3s ease;
        transition-delay: calc(0.05s * var(--index, 0));
    }
    
    .nav-links.active li {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Стили для переключателя Speaker Boost */
.switch-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 15px 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background: linear-gradient(135deg, #FF7F50, #FF6347);
}

input:focus + .toggle-slider {
    box-shadow: 0 0 1px #FF7F50;
}

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