* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #F3F3F3;
    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;
}

.wishes-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px;
    border: 2px solid #411E5E  /* Dark blue  */;
    border-radius: 10px;
    background: #F3F3F3  /* Light Gray  */;
    text-align: left;
}

.wish-item {
    padding: 5px 10px;
    border-radius: 15px;
    background: #F3F3F3  /* Light Gray  */;
    cursor: pointer;
    user-select: none;
}

.wish-item.selected {
    background: #7E33A6  /* Med Blue  */;
    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: 70px; /* Отступ снизу для футера (высота футера + запас) */
    box-sizing: border-box;
}


@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;
}
 /* 22 Dec 2025 BEGIN*/
.text-toolbar button {
    padding: 5px !important;          /* Маленькие отступы вокруг иконки */
    min-width: unset !important;      /* Убираем минимальную ширину */
    width: 30px !important;           /* Фиксированная ширина как у color-button */
    height: 30px !important;          /* Фиксированная высота для квадратной формы */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
}
.text-toolbar button img {
    width: 22px !important;
    height: 22px !important;
    display: block;
}
 /* 22 Dec 2025 END*/

/* Для заголовка дополнительно */
.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: 500px;
    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;
}



.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 #800020;
}

button {
    padding: 5px 15px;
    border: 2px solid #411E5E;
    border-radius: 5px;
    background: #E3E1E4  /* Light Blue  */;
    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, #411E5E, #E3E1E4);
    color: white;
    padding: 5px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.gradient-btn:hover {
    background: linear-gradient(90deg, #E3E1E4, #411E5E);
}

/* Стили для галереи стилей */
.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 #411E5E;
    border-radius: 7px;
}

/* Спиннер */
.spinner {
    display: none;
    text-align: center;
    margin-top: 10px;
}

.spinner div {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #411E5E;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    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;
    }
}


.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: 400px;
    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: #411E5E;
    color: white;
    cursor: pointer;
}

.modal-content button:hover {
    background-color: #E3E1E4;
}

#qrCode {
    margin: 15px 0;
}

.hidden {
    display: none !important;
}

.sunduk-block {
    padding: 10px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 12px;
    text-align: center;
    margin: 10px auto;
    max-width: 320px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
}

.sunduk-balance {
    font-size: 20px;
    font-weight: bold;
    margin: 15px 0;
    color: #2c3e50;
}

.sunduk-buttons, .sunduk-owner-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.sunduk-btn {
    background: #72ca87 !important;  /* Единый зелёный цвет */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    min-width: 120px;
}

.sunduk-btn:hover:not(:disabled) {
    background: #72ca87 !important;
}

.sunduk-btn:disabled {
    background: #6c757d !important;
    cursor: not-allowed;
    opacity: 0.6;
}

.text-block.header-block {
    margin: 40px auto 60px;  /* Отступ сверху и снизу */
    text-align: center;
    width: fit-content;
    max-width: 90%;
    padding: 20px;
    font-size: 2em;
    line-height: 1.2;
}


.close-modal-btn {
    margin-top: 20px;
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}



/* Основные кнопки (blue-btn и gradient-btn) в состоянии disabled */
.blue-btn:disabled,
.gradient-btn:disabled {
    background: #cccccc !important;       /* Серый фон */
    color: #666666 !important;             /* Тёмно-серый текст */
    border-color: #aaaaaa !important;      /* Серый бордер */
    cursor: not-allowed !important;        /* Курсор "запрещено" */
    opacity: 0.6 !important;               /* Лёгкая полупрозрачность для визуального отличия */
    box-shadow: none !important;           /* Убираем тень, если есть */
}

/* Если у gradient-btn есть градиент — полностью перекрываем его серым */
.gradient-btn:disabled {
    background-image: none !important;     /* Убираем градиент */
}

/* Дополнительно: hover-эффект отключён */
.blue-btn:disabled:hover,
.gradient-btn:disabled:hover {
    background: #cccccc !important;
    color: #666666 !important;
    transform: none !important;            /* Если есть эффект поднятия при hover */
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Сама модальная форма */
.modal-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 9999;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal-overlay.active .modal-dialog {
    transform: scale(1);
    opacity: 1;
}