* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #f0f0f0;
    text-align: center;
    font-family: 'Roboto', sans-serif;
    font-size: 16px; /* По умолчанию для текста */
    font-weight: 400; /* Стандартный вес */
    overflow-x: hidden;
    overflow-y: auto; /* Прокрутка по вертикали */
    margin: 0;
    padding: 0;
}

.common-block {
    width: 100%;
    max-width: 640px;
    margin: 10px auto;
    padding: 10px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    position: relative;
    box-sizing: border-box;
}

.hidden {
    display: none;
}

button img {
    width: 16px;
    height: 16px;
    margin-right: 5px;
    vertical-align: middle;
}

.sticker-block {
    margin: 20px auto;
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    text-align: center;
}

.sticker-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 10px;
    cursor: pointer;
}

.sticker-plus {
    font-size: 24px;
    margin-right: 5px;
}

.sticker-menu {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-height: calc(4 * 100px); /* Высота на 4 ряда стикеров */
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.sticker-image {
    width: 100%;
    height: 100%;
    max-width: 100px;
    max-height: 100px;
    cursor: pointer;
}

.sticker-category {
    background: #007bff;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 5px;
}

.photo-block {
    margin: 20px auto;
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    text-align: center;
}

.photo-drop-area {
    border: 2px dashed #ccc;
    padding: 20px;
    cursor: pointer;
}

.photo-drop-area.dragover {
    background: #f0f0f0;
}

.photo-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.photo-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
}

.wishes-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 10px;
    background: #f9f9f9;
    text-align: left;
}

.wish-item {
    padding: 5px 10px;
    border-radius: 15px;
    background: #e0e0e0;
    cursor: pointer;
    user-select: none;
}

.wish-item.selected {
    background: #a0c4ff;
    color: white;
}

.menu-item select {
    margin-left: auto;
}

/* Контейнер для селектора */
.selector-container {
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.6); /* Полупрозрачный белый фон */
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
}

/* Контейнер для UI-элементов (селектор, кнопки, текст) */
.content-overlay {
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Выравнивание к верху */
    align-items: center; /* Центрирование по горизонтали сохраняем */
    min-height: 100vh; /* Высота всей страницы */
    padding-top: 20px; /* Отступ сверху для эстетики */
    padding-bottom: 60px; /* Отступ снизу для футера (высота футера + запас) */
}

.color-container {
    position: relative;
    display: inline-block;
}

.color-button {
    width: 40px;
    height: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
}

.color-option {
    display: flex;
    align-items: center;
    padding: 2px;
    cursor: pointer;
}

.color-option:hover {
    background-color: #f0f0f0;
}

@keyframes fadeInSparkle {
    from { opacity: 0; filter: blur(10px); transform: scale(0.8); }
    to { opacity: 1; filter: blur(0); transform: scale(1); }
}

.text-block {
    animation: fadeInSparkle 1.5s ease-out;
    margin: 20px auto;
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    position: relative;
    z-index: 10;
    box-sizing: border-box;
}

.text-toolbar {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
    transition: opacity 0.2s ease;
}

/* Для заголовка дополнительно */
.text-block[data-is-header="true"] {
    margin-top: 0; /* Убираем верхний отступ для первого элемента */
}

.text-block[data-is-header="true"] .text-content {
    font-size: 18px; /* Для заголовков */
    font-weight: 400; /* Стандартный вес */
    text-align: center;
}

.font-test-block {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 10px;
    z-index: 1000;
    max-width: 600px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.characters-list {
    margin-bottom: 10px;
}

.characters-list div {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
}

.characters-list button {
    margin-left: auto;
}

.dialog-form {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    margin: 10px 0;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    box-sizing: border-box;
    position: relative; /* Добавлено для z-index */
    z-index: 900; /* Выше всех элементов кроме футера */
}

.dialog-form label {
    display: block;
    margin-bottom: 5px;
}

.dialog-form select,
.dialog-form input,
.dialog-form textarea {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

.dialog-form h2 {
    margin-bottom: 15px;
    font-size: 18px;
    text-align: center;
}

.required-star {
    color: #800020;
    font-size: 16px;
    margin-left: 2px;
}

.video-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 5px 5px 0 0;
}

.video-title {
    font-size: 16px;
    font-weight: bold;
}

.video-drop-area {
    border: 2px dashed #ccc;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    margin: 10px 0;
}

.video-drop-area.dragover {
    background: #e0e0e0;
}

.video-preview {
    max-width: 640px; /* Ограничение ширины контейнера, как у .common-block */
    margin: 10px auto; /* Центрирование */
    text-align: center; /* Для центрирования изображения */
}

.video-preview img {
    max-width: 100%; /* Ограничение ширины изображения */
    object-fit: contain; /* Сохранение пропорций */
    width: 100%; /* Заполнение контейнера */
    max-height: 400px; /* Ограничение высоты для больших изображений */
    border-radius: 10px; /* Сохранение стиля */
    display: block; /* Убираем лишние отступы */
}

/* Адаптация для маленьких экранов */
@media screen and (max-width: 720px) {
    .common-block {
        max-width: 100%; /* На экранах меньше 720px занимает всю ширину */
        padding: 8px; /* Уменьшаем внутренние отступы для компактности */
    }
    .video-preview {
        max-width: 100%; /* Адаптация для мобильных */
    }
}

/* Минимальная ширина для совсем узких экранов */
@media screen and (max-width: 360px) {
    .common-block {
        padding: 5px;
    }
    .video-preview {
        max-width: 100%;
    }
}

.tooltip {
    visibility: hidden;
    position: absolute;
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    z-index: 1000;
}

label:hover .tooltip, 
input:hover + .tooltip, 
select:hover + .tooltip {
    visibility: visible;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
}

input:invalid, 
select:invalid {
    border: 2px solid red;
}

button {
    padding: 5px 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: white;
    cursor: pointer;
}

button:hover {
    background: #f0f0f0;
}

.blue-btn {
    background: #007bff;
    color: white;
    padding: 5px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.blue-btn:hover {
    background: #0056b3;
}

.gradient-btn {
    background: linear-gradient(90deg, #007bff, #00d4ff);
    color: white;
    padding: 5px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.gradient-btn:hover {
    background: linear-gradient(90deg, #0056b3, #0096cc);
}

/* Стили для галереи стилей */
.style-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
}

.style-thumbnail-wrapper {
    text-align: center;
    position: relative;
    cursor: pointer;
}

#generate_image_runway_dlg .style-thumbnail {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #ccc;
}

#generate_video_dlg .style-thumbnail {
    width: 300px;
    height: 300px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #ccc;
}

.style-thumbnail-wrapper span {
    display: block;
    font-size: 12px;
    margin-top: 5px;
    color: #333;
}

/* Иконка выбора */
.select-icon {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    padding: 2px;
}

/* Стиль для выбранного элемента */
.style-thumbnail-wrapper.selected {
    border: 2px solid #007bff;
    border-radius: 7px;
}

/* Спиннер */
.spinner {
    display: none;
    text-align: center;
    margin-top: 10px;
}

.spinner div {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Адаптация для маленьких экранов */
@media screen and (max-width: 720px) {
    .style-gallery {
        max-width: 100%;
    }
    #generate_image_runway_dlg .style-thumbnail {
        width: 150px;
        height: 150px;
    }
    #generate_video_dlg .style-thumbnail {
        width: 150px;
        height: 150px;
    }
    .style-thumbnail-wrapper span {
        font-size: 10px;
    }
}

/* Минимальная ширина для узких экранов */
@media screen and (max-width: 360px) {
    .style-gallery {
        gap: 5px;
    }
    #generate_image_runway_dlg .style-thumbnail {
        width: 100px;
        height: 100px;
    }
    #generate_video_dlg .style-thumbnail {
        width: 100px;
        height: 100px;
    }
}


/* Предполагается, что это дополнение к существующему styles.css */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    text-align: center;
}

.modal-content h2 {
    margin-bottom: 15px;
}

.modal-content input[type="text"] {
    width: 100%;
    padding: 8px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.modal-content button {
    padding: 8px 16px;
    margin: 5px;
    border: none;
    border-radius: 4px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
}

.modal-content button:hover {
    background-color: #0056b3;
}

#qrCode {
    margin: 15px 0;
}

.hidden {
    display: none !important;
}