/* ============================================
   ОБЩИЕ СТИЛИ ДЛЯ WEB APP
   ============================================ */

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat-Italic-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

:root {
    --tg-safe-area-top: var(--tg-safe-area-inset-top, 0px);
    --tg-safe-area-bottom: var(--tg-safe-area-inset-bottom, 0px);
    --tg-safe-area-left: var(--tg-safe-area-inset-left, 0px);
    --tg-safe-area-right: var(--tg-safe-area-inset-right, 0px);
    --tg-content-safe-area-top: var(--tg-content-safe-area-inset-top, 0px);
    --tg-content-safe-area-bottom: var(--tg-content-safe-area-inset-bottom, 0px);
    --tg-content-safe-area-left: var(--tg-content-safe-area-inset-left, 0px);
    --tg-content-safe-area-right: var(--tg-content-safe-area-inset-right, 0px);

    --safe-area-top: calc(var(--tg-safe-area-top) + var(--tg-content-safe-area-top));
    --safe-area-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--tg-safe-area-bottom) + var(--tg-content-safe-area-bottom));
    --safe-area-left: calc(env(safe-area-inset-left, 0px) + var(--tg-safe-area-left) + var(--tg-content-safe-area-left));
    --safe-area-right: calc(env(safe-area-inset-right, 0px) + var(--tg-safe-area-right) + var(--tg-content-safe-area-right));

    /* Цветовая палитра */
    --accent-blue: #d9005b;
    --primary-color: var(--accent-blue);
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --bg-color: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --text-muted: rgba(51, 51, 51, 0.6);
    --shadow-soft-sm: 0 4px 15px rgba(0, 45, 89, 0.08);
    --shadow-soft: 0 6px 15px rgba(0, 45, 89, 0.08);
    --shadow-soft-lg: 0 10px 20px rgba(0, 45, 89, 0.08);
    --shadow-soft-up: 0 -6px 15px rgba(0, 45, 89, 0.08);
    --shadow-soft-inset: 0 0 0 1px rgba(0, 45, 89, 0.08);
    --shadow-focus: 0 0 0 3px rgba(0, 45, 89, 0.12);

    /* Размеры */
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --spacing-xs: 10px;
    --spacing-sm: 15px;
    --spacing-md: 20px;
    --spacing-lg: 30px;
    --spacing-xl: 40px;
}

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

.mb-3 {
    margin-bottom: 2rem !important;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #ffe3f5 0%, #fffafd 20%);
    color: var(--text-color);
    overflow-x: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
}


/* Скроллбар */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-blue);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #0056cc;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-blue) transparent;
}

/* ============================================
   ОСНОВНОЙ КОНТЕЙНЕР
   ============================================ */

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: var(--spacing-md);
}

/* ============================================
   ТИПОГРАФИКА
   ============================================ */

h1,
h2,
h3,
.page-title {
    color: #000000;
    text-align: left;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    /* Semibold */
    margin-bottom: var(--spacing-xs);
}

.intro-container h2,
.intro-container .page-title {
    text-align: center;
}

h2,
.page-title {
    font-size: clamp(26px, 6vw, 34px);
}

.subtitle,
.page-subtitle,
p.subtitle {
    color: rgba(51, 51, 51, 0.6);
    /* Полупрозрачный */
    text-align: center;
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    /* Regular */
    font-size: clamp(14px, 3.5vw, 16px);
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
}

.select-animations-container .subtitle {
    text-align: left;
}

.text-accent {
    color: var(--accent-blue);
    font-weight: 600;
}

/* ============================================
   КНОПКИ (УНИФИЦИРОВАННЫЙ СТИЛЬ)
   ============================================ */

/* Базовый стиль для всех кнопок */
.btn-primary,
.btn-secondary,
.btn-next,
.btn-back,
.btn-apply-colors,
.btn-change-logo {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

/* Основная кнопка */
.btn-primary,
.btn-next {
    background-color: var(--accent-blue);
    color: white;
}

.btn-primary.btn-success,
.btn-next.btn-success {
    background-color: #28a745;
}

.btn-primary:hover,
.btn-next:hover {
    background-color: #0056cc;
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.btn-primary.btn-success:hover,
.btn-next.btn-success:hover {
    background-color: #21913b;
    box-shadow: var(--shadow-soft);
}

.btn-primary:disabled,
.btn-next:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Вторичная кнопка */
.btn-secondary {
    background-color: #d9d9d9;
    color: #000000;
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

/* Кнопка назад */
.btn-back {
    background: transparent;
    color: var(--text-muted);
    font-weight: 400;
    padding: 12px 0px;
}

.btn-back:hover {
    color: var(--text-color);
    background-color: rgba(0, 0, 0, 0.05);
}

/* Кнопка применения цветов */
.btn-apply-colors {
    margin-top: var(--spacing-sm);
    padding: 10px 20px;
    background: var(--accent-blue);
    color: white;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 500;
}

.btn-apply-colors:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Кнопка изменения лого */
.btn-change-logo {
    padding: 6px 12px;
    background: transparent;
    color: var(--accent-blue);
    border-radius: var(--border-radius-sm);
    font-size: 12px;
    font-weight: 500;
}

.btn-change-logo:hover {
    background-color: rgba(0, 119, 255, 0.1);
}

/* ============================================
   КОНТЕЙНЕРЫ СТРАНИЦ (УНИФИЦИРОВАННЫЙ СТИЛЬ)
   ============================================ */

.intro-container,
.select-animations-container,
.upload-svg-container,
.preview-container,
.select-tariff-container,
.select-stickers-container,
.thanks-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

.select-stickers-container {
    padding-top: calc(var(--safe-area-top)) !important;
}

.select-animations-container {
    padding-top: calc(var(--safe-area-top)) !important;
}

.upload-svg-container {
    padding-top: calc(var(--safe-area-top)) !important;
}

html,
body {
    touch-action: manipulation;
}

/* ============================================
   ИНДИКАТОРЫ ЭТАПОВ
   ============================================ */

.step-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-xs);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #d0d0d0;
    transition: all 0.3s ease;
}

.step-dot.active {
    background-color: var(--accent-blue);
    width: 12px;
    height: 12px;
}

.preview-step-indicators {
    position: fixed;
    bottom: 80px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-xs);
    z-index: 999;
}

.preview-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: none;
    padding-top: calc(var(--spacing-md) + var(--safe-area-top));

}

.preview-header-inner {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    padding: 0 var(--spacing-md);
    text-align: center;
}

.preview-header .page-title {
    margin-bottom: var(--spacing-sm);
}

.preview-tabs {
    display: flex;
    background-color: #ffffff;
    border-radius: 24px;
    border: none;
    padding: 4px;
    margin: 0 auto;
    width: 100%;
    max-width: 560px;
    position: relative;
    justify-content: space-between;
    align-items: center;
    gap: 2px;
    overflow: hidden;
    box-shadow: var(--shadow-soft-sm);
}

.preview-tabs-slider {
    position: absolute;
    top: 2px;
    left: 0;
    width: 0;
    height: calc(100% - 4px);
    background-color: rgb(232, 232, 232);
    border-radius: 24px;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.preview-tabs-option {
    flex: 1;
    padding: 10px 6px;
    border: none;
    border-radius: 24px;
    font-size: clamp(11px, 2.8vw, 14px);
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s ease;
    background-color: transparent;
    color: var(--text-color);
    position: relative;
    z-index: 1;
    text-align: center;
    white-space: normal;
    line-height: 1.1;
}


/* ============================================
   INTRO СЛАЙДЫ
   ============================================ */

.intro-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 100px);
    position: relative;
    isolation: isolate;
}

.intro-container::before {
    content: "";
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: min(1300px, 165vw);
    height: 380px;
    border-radius: 0 0 50% 50%;
    background: #ff00a2;
    z-index: -1;
    pointer-events: none;
}

.intro-slide {
    display: none;
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    flex: 1;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    pointer-events: none;
}

.intro-slide.active {
    display: flex;
    opacity: 1;
    transform: translateX(0);
    position: relative;
    pointer-events: auto;
}

.intro-slide.slide-out-left {
    opacity: 0;
    transform: translateX(-100%);
    pointer-events: none;
}

.intro-slide.slide-out-right {
    opacity: 0;
    transform: translateX(100%);
    pointer-events: none;
}

.intro-lottie-container {
    width: 100%;
    max-width: 230px;
    height: 230px;
    margin: 0 auto var(--spacing-xl);
    display: flex;
    align-items: center;
    justify-content: center;
}

.intro-lottie-player {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slide-content {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.slide-content h2 {
    font-size: clamp(22px, 5vw, 28px);
    margin-bottom: var(--spacing-md);
    color: var(--accent-blue);
}

.slide-content p {
    font-size: clamp(14px, 3.5vw, 16px);
    color: var(--text-muted);
    margin-bottom: var(--spacing-xl);
    line-height: 1.6;
}

.intro-pagination {
    position: fixed;
    bottom: 100px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    padding: 0 var(--spacing-md);
}

.intro-pagination .step-indicators {
    position: static;
    transform: none;
}

/* ============================================
   СТИКЕРЫ
   ============================================ */

.sticker-class-group {
    margin: var(--spacing-lg) 0;
    margin-bottom: var(--spacing-xl);
}

.select-animations-container,
.select-stickers-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.select-animations-container {
    padding-bottom: calc(var(--spacing-xl) + 80px);
}

.select-animations-container .sticker-class-group,
.select-stickers-container .sticker-class-group {
    margin: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 40px;
}

.sticker-class-title {
    font-size: clamp(16px, 4vw, 18px);
    font-weight: 300;
    color: #666666;
    text-align: left;
}

.sticker-class-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    margin-bottom: 20px;

}

.sticker-class-select-all {
    background: transparent;
    border: none;
    border-radius: 999px;
    padding: 6px 10px;
    margin-bottom: 10px;
    font-size: clamp(11px, 3vw, 12px);
    color: var(--text-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-soft-sm);
}

.sticker-class-select-all:hover {
    color: var(--accent-blue);
    box-shadow: var(--shadow-soft);
}

.select-all-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: none;
    background-color: #ffffff;
    box-shadow: var(--shadow-soft-inset);
    display: inline-block;
}

.sticker-class-select-all.is-active .select-all-indicator {
    background-color: var(--accent-blue);
    box-shadow: none;
    border-color: var(--accent-blue);
}

.sticker-class-group {
    position: relative;
}

.stickers-grid-wrapper {
    position: relative;
}

.stickers-grid-wrapper .stickers-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.86);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 2;
}

.stickers-grid-wrapper .stickers-loading-overlay[aria-hidden="true"] {
    display: none;
}

.stickers-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: var(--spacing-sm);
    align-items: stretch;
    padding-bottom: 0;
}

.custom-offer-block {
    margin-top: 32px;
    text-align: center;
    color: #8a8a8a;
    font-size: 14px;
    line-height: 1.5;
    padding-bottom: 110px;
}

.custom-offer-button {
    display: block;
    width: fit-content;
    margin: 12px auto 0;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 10px;
    background: #e6e6e6;
    color: #333;
    text-decoration: none;
}

.sticker-item {
    position: relative;
    border: none;
    border-radius: var(--border-radius);
    padding: 5px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 0;
    aspect-ratio: 1;
    /* Делаем карточки квадратными */
    overflow: hidden;
    box-shadow: var(--shadow-soft-sm);
    --selection-rotation: 0deg;
    --selection-scale: 1;
    transform: rotate(var(--selection-rotation)) scale(var(--selection-scale));
    transform-origin: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.sticker-item,
.sticker-item * {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.sticker-item:hover {
    transform: rotate(var(--selection-rotation)) scale(var(--selection-scale));
    box-shadow: var(--shadow-soft-sm);
}

.sticker-item.selected {
    border: 2px solid var(--accent-blue);
    background-color: #e3f2fd;
    box-shadow: none;
    z-index: 3;
}

.sticker-preview {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.00);
    min-height: 0;
    /* Предотвращаем растягивание */
}

.sticker-preview-large {
    width: 100%;
    max-width: none;
    aspect-ratio: 1;
    margin: var(--spacing-md) auto;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--border-radius);
    background-color: transparent;

}

.sticker-preview-large-group {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.sticker-preview-large-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 180px;
}

.sticker-preview-large-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: center;
}
.change-logo-link {
    display: inline-block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--accent-blue, #1a73e8);
    text-decoration: none;
    font-weight: 500;
}
.change-logo-link:hover {
    text-decoration: underline;
}

.sticker-preview-large-muted {
    background-color: #f7f7f7;
    position: relative;
    overflow: hidden;
}

.sticker-preview-large-muted::before {
    content: "";
    position: absolute;
    inset: -8px;
    background: #f7f7f7;
    filter: blur(12px);
    z-index: 0;
}

.sticker-preview-large-muted > * {
    position: relative;
    z-index: 1;
}

.lottie-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-error {
    font-size: 24px;
    color: #999;
}

.checkmark {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: var(--accent-blue);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.sticker-preview-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1600;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 20px;
}

.sticker-preview-modal-overlay[aria-hidden="true"] {
    display: none;
}

.sticker-preview-modal {
    position: relative;
    width: 100%;
    max-width: 360px;
    background: #fff;
    border-radius: 18px;
    padding: 18px 16px 14px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
}

.sticker-preview-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 999px;
    background: #f2f2f2;
    color: #666;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.sticker-preview-modal-title {
    margin: 0 0 12px;
    padding-right: 36px;
    font-size: 16px;
    font-weight: 700;
    color: #222;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.sticker-preview-modal-body {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: #f8f9fb;
    padding: 12px;
}

.sticker-preview-modal-image {
    display: none;
    width: 100%;
    max-width: 280px;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 12px;
    background: transparent;
}

.sticker-preview-modal-loading,
.sticker-preview-modal-error {
    display: none;
    text-align: center;
    font-size: 14px;
    line-height: 1.4;
    color: #666;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.sticker-preview-modal-error {
    color: #bf3f3f;
}

.selected-count,
.tariff-info {
    text-align: center;
    font-size: clamp(14px, 3.5vw, 16px);
    margin: var(--spacing-sm) 0;
    color: #666;
}

.selected-count strong {
    color: var(--accent-blue);
}

/* ============================================
   ЗАГРУЗКА ФАЙЛА
   ============================================ */

.file-input-wrapper {
    position: relative;
    margin: 60px auto;
    max-width: 300px;
}

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

.file-input-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 300px;
    height: 300px;
    margin: 0 auto;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #ffffff;
    box-shadow: var(--shadow-soft);
}

.file-input-label:hover {
    background-color: rgba(0, 119, 255, 0.05);
    box-shadow: var(--shadow-soft-lg);
}

.file-input-hint {
    text-align: center;
    margin-top: var(--spacing-sm);
    color: var(--text-muted);
    font-size: clamp(12px, 3vw, 14px);
}

.file-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-xs);
}

.file-upload-icon {
    width: 56px;
    height: 56px;
    margin-bottom: var(--spacing-xs);
    display: block;
}

.file-text {
    font-size: clamp(16px, 4vw, 18px);
    color: var(--text-color);
    font-weight: 500;
}

.file-name {
    text-align: center;
    margin: var(--spacing-sm) 0;
    color: #666;
    font-size: clamp(12px, 3vw, 14px);
}

/* ============================================
   PREVIEW ШАГИ
   ============================================ */

.preview-container {
    padding-top: 120px;
    padding-bottom: 200px;
    position: relative;
    box-sizing: content-box;
}

.change-logo-fab {
    position: absolute;
    top: 120px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft-sm);
    z-index: 1100;
    cursor: pointer;
    padding: 0;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease, width 0.2s ease, padding 0.2s ease;
}

.change-logo-fab:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.change-logo-fab img {
    width: 20px;
    height: 20px;
    display: block;
}

.change-logo-fab.is-expanded img {
    display: none;
}

.change-logo-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color);
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-width 0.2s ease, opacity 0.2s ease;
}

.change-logo-fab.is-expanded {
    width: auto;
    padding: 0 14px 0 12px;
    border-radius: 999px;
}

.change-logo-fab.is-expanded .change-logo-label {
    max-width: 140px;
    opacity: 1;
}

.preview-steps-wrapper {
    position: relative;
    width: 100%;
    margin: var(--spacing-xl) 0;
    overflow: hidden;
}

.preview-step {
    width: 100%;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-step.active {
    opacity: 1;
    transform: translateX(0);
    position: relative;
    pointer-events: auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-right: 20px;
}

.preview-step.slide-out-left {
    opacity: 0;
    transform: translateX(-100%);
    pointer-events: none;
}

.preview-step.slide-out-right {
    opacity: 0;
    transform: translateX(100%);
    pointer-events: none;
}

.preview-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 400px;
    margin: var(--spacing-md) auto;
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: transparent;
}

.preview-step[data-step="2"] .preview-wrapper,
.preview-step[data-step="3"] .preview-wrapper,
.preview-step[data-step="4"] .preview-wrapper {
    max-width: 250px;
    height: 250px;
}

.preview-wrapper-size {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: nowrap;
    align-items: center;
    margin: var(--spacing-md) 0;
}

.preview-item-size {
    position: relative;
    width: 200px;
    height: 200px;
    background-color: transparent;
}

.lottie-back-layer,
.lottie-front-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.lottie-back-layer {
    z-index: 1;
}

.lottie-front-layer {
    z-index: 2;
}

.scale-control-container {
    bottom: 80px;
    left: 0;
    right: 0;
    margin: 0;
    margin-bottom: 41px;
    padding: var(--spacing-md);
    padding-left: var(--spacing-xl);
    padding-right: var(--spacing-xl);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    z-index: 999;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-control-container.hidden {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

.scale-label {
    display: block;
    text-align: center;
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-color);
}

.scale-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.scale-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
}

.scale-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    border: none;
}

/* ============================================
   ЦВЕТОВЫЕ ПИКЕРЫ
   ============================================ */

.color-picker-container {
    margin: var(--spacing-md) 0;
    padding: var(--spacing-md);
    background-color: #ffffff;
    border-radius: var(--border-radius);
    width: 100%;
    box-sizing: border-box;
    box-shadow: var(--shadow-soft);
}

.color-picker-label {
    font-size: clamp(12px, 3vw, 14px);
    font-weight: 600;
    color: var(--text-color);
}

.color-picker-hint {
    font-size: clamp(12px, 3vw, 14px);
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

.color-pickers {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    width: 100%;
}

.color-pickers.logo-colors {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--spacing-sm);
    width: 100%;
    box-sizing: border-box;
}

.color-picker-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    width: 100%;
}

.color-pickers.logo-colors .color-picker-item {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
    width: 100%;
}

.color-picker-item-label {
    font-size: clamp(12px, 3vw, 14px);
    font-weight: 500;
    color: var(--text-color);
    min-width: 70px;
}

.color-swatch {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
    display: block;
    box-shadow: var(--shadow-soft-inset);
}

.color-swatch input[type="color"] {
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    cursor: pointer;
    background: transparent;
}

.color-swatch input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-swatch input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.color-hex-input {
    flex: 1;
    min-width: 120px;
    padding: 10px 14px;
    font-size: clamp(12px, 3vw, 14px);
    font-family: 'Monaco', 'Consolas', monospace;
    border: none;
    border-radius: var(--border-radius);
    background: var(--bg-color);
    color: var(--text-color);
    box-shadow: var(--shadow-soft-inset);
}

.color-hex-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.color-hex-input-wrapper .color-hex-input {
    width: 100%;
    padding-right: 36px;
}

.color-hex-paste {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.color-hex-paste img {
    width: 16px;
    height: 16px;
    display: block;
}

.color-pickers.logo-colors .color-hex-input {
    width: 100%;
    min-width: 0;
}

.color-hex-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-focus);
}

/* Аккордеон для цветов логотипа */
.color-picker-accordion {
    width: 100%;
    min-width: 100%;
    /* Фиксированная ширина */
    max-width: 100%;
    /* Фиксированная ширина */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.color-picker-accordion-header {
    width: 100%;
    min-width: 100%;
    /* Фиксированная ширина */
    max-width: 100%;
    /* Фиксированная ширина */
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-align: left;
    box-sizing: border-box;
    flex-shrink: 0;
    /* Предотвращаем сжатие */
    flex-grow: 0;
    /* Не растягиваемся */
}


.color-picker-accordion-icon {
    font-size: 12px;
    color: var(--accent-blue);
    transition: transform 0.3s ease;
}

.color-picker-accordion-content {
    width: 100%;
    min-width: 100%;
    /* Фиксированная ширина */
    max-width: 100%;
    /* Фиксированная ширина */
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* ============================================
   ТАРИФЫ
   ============================================ */

.tariff-single-pack {
    margin-bottom: 0;
}

.sticker-preview-large {
    position: relative;
}

.sticker-preview-large canvas,
.sticker-preview-large svg {
    width: 100%;
    height: 100%;
}

.large-preview-layer {
    position: absolute;
    inset: 0;
    opacity: 1;
    transition: opacity 0.35s ease;
}

.large-preview-placeholder-hidden {
    opacity: 0;
}

.large-preview-content {
    opacity: 0;
}

.large-preview-content-visible {
    opacity: 1;
}

.tariff-toggle {
    display: flex;
    background-color: #ffffff;
    border-radius: 24px;
    border: none;
    padding: 4px;
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    margin-left: var(--spacing-md);
    margin-right: var(--spacing-md);
    width: calc(100% - 40px);
    position: relative;
    justify-content: flex-start;
    align-items: center;
    box-shadow: var(--shadow-soft-sm);
}

.free-sets-card {
    margin: 0 var(--spacing-md) var(--spacing-md);
    padding: 14px 14px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: var(--shadow-soft-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
}

.free-sets-card-title {
    font-size: clamp(14px, 3.6vw, 16px);
    font-weight: 600;
    color: var(--text-color);
}

.free-sets-card-btn {
    border: none;
    border-radius: 999px;
    background: #f1f1f1;
    color: var(--text-color);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.free-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 20px;
}

.free-modal-overlay[aria-hidden="true"] {
    display: none;
}

.free-modal {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 20px;
    padding: 24px 18px 16px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.free-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    border: none;
    background: transparent;
    color: #888;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.free-modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #222;
    text-align: center;
}

.free-modal-text {
    color: #444;
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
}

.free-modal-text a {
    color: var(--accent-blue);
    text-decoration: none;
}

.free-modal-actions {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.free-modal-action {
    width: 100%;
}

.free-modal-status {
    margin-top: 12px;
    min-height: 18px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

.free-modal-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

[dir="rtl"] .free-modal-text {
    text-align: right;
}

.tariff-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(50% - 2px);
    height: calc(100% - 4px);
    background-color: rgb(237, 237, 237);
    border-radius: 20px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.tariff-toggle.yearly-active .tariff-toggle-slider {
    transform: translateX(100%);
}

.tariff-toggle-option {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 20px;
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 500;
    cursor: pointer;
    transition: color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: transparent;
    color: var(--text-color);
    position: relative;
    z-index: 1;
}


.tariff-options-wrapper {
    position: relative;
    width: 100%;
    margin: var(--spacing-xl) 0;
    min-height: 0;
    overflow: visible;
}

.tariff-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    transform: translateX(100%);
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.tariff-options.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.tariff-options-monthly {
    transform: translateX(0);
}

.tariff-options-monthly.slide-out-left {
    opacity: 0;
    transform: translateX(-100%);
}

.tariff-options-yearly.slide-out-right {
    opacity: 0;
    transform: translateX(100%);
}

.tariff-option {
    padding: 24px var(--spacing-md);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: white;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--shadow-soft);
}

.tariff-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
}

.tariff-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.tariff-title--stack {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.tariff-title-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.tariff-packs-count {
    color: var(--accent-blue);
}

.select-tariff-container .subtitle {
    transition: opacity 0.2s ease;
}

.select-tariff-container .subtitle.is-fading {
    opacity: 0.35;
}

.select-tariff-container .subtitle {
    text-align: left;
}

.tariff-meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.tariff-price {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tariff-offer-icon {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 50px;
    height: 50px;
    display: block;
    pointer-events: none;
}

.tariff-option:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.tariff-option.selected {
    border-color: var(--accent-blue);
    border-width: 2px;
    background-color: #f8f9fa;
    border-style: solid;
    box-shadow: none;
}

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

.tariff-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tariff-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background-color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tariff-checkbox::after {
    content: '';
    width: 6px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
}

.tariff-option.selected .tariff-checkbox {
    opacity: 1;
}

.tariff-title {
    font-size: clamp(16px, 4vw, 18px);
    font-weight: 600;
    color: var(--text-color);
}

.tariff-stickers-count {
    color: var(--accent-blue);
    font-size: clamp(24px, 6vw, 32px);
    font-weight: 700;
}

.tariff-badge {
    background-color: rgba(2, 119, 255, 1);
    color: white;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 10px;
    /* font-weight: 600; */
}


.tariff-name {
    font-size: clamp(14px, 3.5vw, 16px);
    color: var(--text-muted);
    font-weight: 500;
}

.tariff-stars {
    font-size: clamp(12px, 3vw, 14px);
    color: #666666;
    font-weight: 400;
}

.tariff-stars-number {
    color: #FEB922;
}

.tariff-stars {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tariff-stars-left {
    display: flex;
    align-items: center;
}

.tariff-stars-lottie {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    margin-bottom: 8px;
}

.tariff-balance {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.tariff-stars-number {
    color: #666666;
    font-weight: 500;
    font-size: clamp(12px, 3vw, 14px);
}

/* Old price strikethrough */
.tariff-sale-prices {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
    margin-top: 10px;
}

.tariff-stars-old {
    font-size: clamp(9px, 2.2vw, 11px);
    font-weight: 500;
    color: #999;
    text-decoration: line-through;
}

.tariff-price--sale .tariff-stars-number {
    color: #FDA50B;
    font-weight: 700;
}

/* Countdown timer above tariff card */
.tariff-timer-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.tariff-promo-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.tariff-countdown {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-blue);
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
}

.tariff-description {
    text-align: center;
    color: #666;
    margin-bottom: var(--spacing-lg);
}

/* Компактная страница тарифов */
.select-tariff-compact {
    padding-top: var(--spacing-sm);
    padding-bottom: 80px;
}

.select-tariff-compact .page-title {
    margin-bottom: 6px;
}

.select-tariff-compact .subtitle {
    margin-bottom: 12px;
    line-height: 1.4;
}

.select-tariff-compact .tariff-toggle {
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    height: 40px;
}

.select-tariff-compact .tariff-options-wrapper {
    margin: var(--spacing-md) 0;
    min-height: 0;
    gap: 60px;
}

.select-tariff-compact .tariff-option {
    padding: 16px var(--spacing-md);
}

.tariff-video {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    margin-bottom: var(--spacing-md);
    background-color: #000000;
    margin-top: calc(-1 * var(--spacing-sm));
    padding-top: calc(var(--spacing-sm) + var(--safe-area-top));
}

.tariff-video-player {
    width: 100%;
    height: clamp(140px, 25vw, 220px);
    max-height: 220px;
    object-fit: cover;
    display: block;
}

/* ============================================
   НАЗВАНИЕ НАБОРА
   ============================================ */


.pack-name-label {
    display: block;
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--text-color);
}

.pack-name-input {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--border-radius);
    font-size: clamp(14px, 3.5vw, 16px);
    outline: none;
    transition: border-color 0.3s ease;
    background-color: rgba(255, 255, 255, 1);
    color: var(--text-color);
    box-shadow: var(--shadow-soft-inset);
}

.pack-name-input.error {
    border: none;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

.pack-name-input:focus {
    box-shadow: var(--shadow-focus);
}

/* ============================================
   THANKS СТРАНИЦА
   ============================================ */

.thanks-state {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.thanks-state.creating {
    min-height: 70vh;
}

.thanks-state.failed {
    min-height: 70vh;
}

.thanks-icon {
    font-size: clamp(48px, 12vw, 64px);
    margin-bottom: var(--spacing-md);
}

.thanks-loading {
    width: 30%;
    max-width: 160px;
    margin-left: auto;
    margin-right: auto;
}

.thanks-state h2 {
    font-size: clamp(22px, 5vw, 28px);
    margin-bottom: var(--spacing-sm);
    color: var(--text-color);
}

.thanks-state p {
    font-size: clamp(14px, 3.5vw, 16px);
    color: #000000;
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
}

.sticker-groups-wrapper {
    position: relative;
}

.stickers-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: var(--spacing-md);
    z-index: 10;
    min-height: 200px;
    padding-top: var(--spacing-lg);
}

.stickers-loading-overlay[aria-hidden="true"] {
    display: none;
}

.stickers-loading-overlay[aria-hidden="false"] {
    display: flex;
}

.stickers-loading-overlay .loading-spinner {
    margin: 0;
}

.stickers-loading-lottie {
    width: 64px;
    height: 64px;
}

.stickers-loading-text {
    font-size: 0.95rem;
    color: var(--text-secondary, #666);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: var(--spacing-lg) auto;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.pack-link-section {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md);
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
}

.pack-link {
    display: inline-block;
    padding: 12px 24px;
    background-color: var(--accent-blue);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    margin-top: var(--spacing-xs);
    transition: background-color 0.3s ease;
}

.pack-link:hover {
    background-color: #0056cc;
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.create-new-section {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 2px solid var(--border-color);
}

.create-new-section h3 {
    font-size: clamp(20px, 5vw, 24px);
    margin-bottom: var(--spacing-md);
    color: var(--text-color);
}

.create-new-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-width: 400px;
    margin: 0 auto;
}

.create-new-question {
    font-weight: 600;
}

.btn-light {
    background-color: rgba(236, 236, 236, 0.95);
    color: #000000;
    box-shadow: var(--shadow-soft-sm);
}

.btn-light:hover {
    background-color: rgba(230, 230, 230, 1);
    color: #000000;
    box-shadow: var(--shadow-soft);
}

/* ============================================
   СООБЩЕНИЯ ОБ ОШИБКАХ
   ============================================ */

.error-message {
    padding: var(--spacing-sm);
    background-color: #fee;
    border: none;
    border-radius: var(--border-radius);
    color: var(--danger-color);
    margin: var(--spacing-md) 0;
    text-align: center;
    box-shadow: var(--shadow-soft);
}

.error-chip {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: var(--spacing-sm) 24px;
    background-color: white;
    border: none;
    border-radius: var(--border-radius);
    color: var(--danger-color);
    font-size: clamp(12px, 3vw, 14px);
    font-weight: 600;
    z-index: 2000;
    box-shadow: var(--shadow-soft);
    animation: slideUpFadeIn 0.3s ease forwards, slideDownFadeOut 0.3s ease 2.7s forwards;
}

.info-chip {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: var(--spacing-sm) 24px;
    background-color: white;
    border: none;
    border-radius: var(--border-radius);
    color: var(--accent-blue);
    font-size: clamp(12px, 3vw, 14px);
    font-weight: 600;
    z-index: 2000;
    box-shadow: var(--shadow-soft);
    animation: slideUpFadeIn 0.3s ease forwards, slideDownFadeOut 0.3s ease 2.7s forwards;
}

@keyframes slideUpFadeIn {
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes slideDownFadeOut {
    to {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
}

/* ============================================
   КНОПКИ ШАГОВ
   ============================================ */

.step-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: row;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    padding-bottom: calc(var(--spacing-sm) + var(--safe-area-bottom));
    background-color: transparent;
    border-top: none;
    box-shadow: none;
    z-index: 1000;
    justify-content: center;
}

.step-buttons-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: var(--spacing-sm) var(--spacing-md);
    padding-bottom: calc(var(--spacing-sm) + var(--safe-area-bottom));
    border-top: none;
    z-index: 1000;
    box-shadow: var(--shadow-soft-up);
}

.step-buttons-wrapper--no-bg {
    background-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

.step-buttons-wrapper .selected-count-above {
    margin-bottom: var(--spacing-sm);
}

.step-buttons-wrapper .step-buttons {
    position: static;
    background-color: transparent;
    border-top: none;
    box-shadow: none;
    padding: 0;
}

/* Унифицированные стили для кнопок в контейнерах */
.intro-container .step-buttons .btn-primary,
.upload-svg-container+.step-buttons .btn-primary,
.select-tariff-container .step-buttons .btn-primary,
.preview-container .step-buttons .btn-primary,
.select-stickers-container .step-buttons .btn-primary,
.select-animations-container .step-buttons .btn-primary {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    transition: max-width 0.3s ease;
}

.upload-svg-container ~ .step-buttons-wrapper .step-buttons .btn-primary {
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
    transition: max-width 0.3s ease;
}

.select-tariff-container .step-buttons:has(.btn-back) .btn-primary,
.select-stickers-container .step-buttons:has(.btn-back) .btn-primary,
.select-animations-container .step-buttons:has(.btn-back) .btn-primary {
    max-width: 200px;
}

.preview-container .step-buttons .btn-primary.step-2-plus {
    max-width: 200px;
}

.select-tariff-container .step-buttons,
.preview-container .step-buttons,
.select-stickers-container .step-buttons,
.select-animations-container .step-buttons {
    justify-content: center;
}

.upload-svg-container ~ .step-buttons-wrapper .step-buttons {
    justify-content: center;
}

.select-tariff-container .step-buttons .btn-back,
.preview-container .step-buttons .btn-back,
.select-stickers-container .step-buttons .btn-back,
.select-animations-container .step-buttons .btn-back {
    position: absolute;
    left: var(--spacing-md);
    flex: 0 0 auto;
}

.upload-svg-container ~ .step-buttons-wrapper .step-buttons .btn-back {
    position: absolute;
    left: var(--spacing-md);
    flex: 0 0 auto;
}

.selected-count-above {
    text-align: center;
    font-size: clamp(12px, 3vw, 14px);
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

.selected-count-above--with-action {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.selected-clear {
    position: absolute;
    right: var(--spacing-md);
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: var(--text-muted);
    cursor: pointer;
}

.selected-clear:hover {
    color: var(--text-color);
}


.selected-count-above strong {
    color: var(--accent-blue);
}

.step-buttons .btn-create {
    margin: 0 auto;
}

/* Отступы для контента */
.preview-container,
.select-animations-container,
.upload-svg-container,
.select-tariff-container,
.select-stickers-container,
.intro-container {
    padding-bottom: 100px;
}

.select-tariff-compact {
    padding-bottom: 80px;
}

.select-stickers-container {
    padding-bottom: 180px;
}

.preview-container {
    padding-bottom: 200px;
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

/* Мобильные устройства (до 576px) */
@media (max-width: 575.98px) {
    .app-container {
        padding: var(--spacing-xs);
    }

    .intro-container,
    .select-animations-container,
    .upload-svg-container,
    .preview-container,
    .select-tariff-container,
    .select-stickers-container,
    .thanks-container {
        padding: var(--spacing-xs);
        margin-bottom: 110px;
    }

    .stickers-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: var(--spacing-xs);
    }

    .sticker-item {
        min-height: 0;

    }

    .sticker-preview-large {
        max-width: 130px;
    }

    .intro-lottie-container {
        max-width: 190px;
        height: 190px;
    }

    .file-input-label {
        max-width: 200px;
        height: 200px;
    }

    .preview-wrapper {
        max-width: 280px;
        height: 280px;
    }

    .preview-container {
        padding-top: calc(112px + var(--safe-area-top));
    }

    .preview-step[data-step="2"] .preview-wrapper,
    .preview-step[data-step="3"] .preview-wrapper,
    .preview-step[data-step="4"] .preview-wrapper {
        max-width: 200px;
        height: 200px;
    }



    .scale-control-container {
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
    }

    .tariff-toggle {
        margin-left: var(--spacing-xs);
        margin-right: var(--spacing-xs);
        width: calc(100% - 20px);

    }

    .tariff-option {
        padding: var(--spacing-md) var(--spacing-sm);
    }


    .color-hex-input {
        min-width: 100px;
    }

    .step-buttons {
        padding: var(--spacing-xs) var(--spacing-sm);
        padding-bottom: calc(var(--spacing-xs) + var(--safe-area-bottom));
    }

    .step-buttons-wrapper {
        padding-bottom: calc(20px + var(--spacing-xs) + var(--safe-area-bottom));
    }

    .select-stickers-container {
        padding-bottom: 120px;
    }

    .select-tariff-container .step-buttons .btn-back,
    .preview-container .step-buttons .btn-back,
    .select-stickers-container .step-buttons .btn-back,
    .select-animations-container .step-buttons .btn-back {
        left: var(--spacing-sm);
    }
}

/* Планшеты (576px - 768px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .stickers-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }

    .sticker-preview-large {
        max-width: 200px;
    }
}

/* ============================================
   RTL (Right-to-Left) — Persian / Arabic
   ============================================ */

[dir="rtl"] body {
    font-family: 'Vazirmatn', 'Tahoma', 'Arial', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Типографика */
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] .page-title {
    text-align: right;
}

[dir="rtl"] .intro-container h2,
[dir="rtl"] .intro-container .page-title {
    text-align: center;
}

[dir="rtl"] .select-animations-container .subtitle {
    text-align: right;
}

[dir="rtl"] .select-tariff-container .subtitle {
    text-align: right;
}

[dir="rtl"] .sticker-class-title {
    text-align: right;
}

/* Checkmark на стикерах */
[dir="rtl"] .checkmark {
    right: auto;
    left: 5px;
}

/* Offer icon на тарифах */
[dir="rtl"] .tariff-offer-icon {
    right: auto;
    left: -3px;
}

/* Кнопка изменения лого */
[dir="rtl"] .change-logo-fab {
    right: auto;
    left: 20px;
}

[dir="rtl"] .change-logo-fab.is-expanded {
    padding: 0 12px 0 14px;
}

/* Кнопки назад */
[dir="rtl"] .select-tariff-container .step-buttons .btn-back,
[dir="rtl"] .preview-container .step-buttons .btn-back,
[dir="rtl"] .select-stickers-container .step-buttons .btn-back,
[dir="rtl"] .select-animations-container .step-buttons .btn-back {
    left: auto;
    right: var(--spacing-md);
}

[dir="rtl"] .upload-svg-container ~ .step-buttons-wrapper .step-buttons .btn-back {
    left: auto;
    right: var(--spacing-md);
}

/* Selected clear */
[dir="rtl"] .selected-clear {
    right: auto;
    left: var(--spacing-md);
}

/* Paste button в hex input */
[dir="rtl"] .color-hex-paste {
    right: auto;
    left: 10px;
}

[dir="rtl"] .color-hex-input-wrapper .color-hex-input {
    padding-right: 14px;
    padding-left: 36px;
}

/* Color picker accordion */
[dir="rtl"] .color-picker-accordion-header {
    text-align: right;
}

/* Tariff title stack */
[dir="rtl"] .tariff-title--stack {
    align-items: flex-end;
}

/* Slide animations — инвертируем направления */
[dir="rtl"] .intro-slide {
    transform: translateX(-100%);
}

[dir="rtl"] .intro-slide.active {
    transform: translateX(0);
}

[dir="rtl"] .intro-slide.slide-out-left {
    transform: translateX(100%);
}

[dir="rtl"] .intro-slide.slide-out-right {
    transform: translateX(-100%);
}

[dir="rtl"] .preview-step {
    transform: translateX(-100%);
}

[dir="rtl"] .preview-step.active {
    transform: translateX(0);
    padding-right: 0;
    padding-left: 20px;
}

[dir="rtl"] .preview-step.slide-out-left {
    transform: translateX(100%);
}

[dir="rtl"] .preview-step.slide-out-right {
    transform: translateX(-100%);
}

/* Tariff options slides */
[dir="rtl"] .tariff-options {
    transform: translateX(-100%);
}

[dir="rtl"] .tariff-options.active {
    transform: translateX(0);
}

[dir="rtl"] .tariff-options-monthly.slide-out-left {
    transform: translateX(100%);
}

[dir="rtl"] .tariff-options-yearly.slide-out-right {
    transform: translateX(-100%);
}

/* Scale control hidden */
[dir="rtl"] .scale-control-container.hidden {
    transform: translateX(100%);
}

/* Tariff toggle slider */
[dir="rtl"] .tariff-toggle-slider {
    left: auto;
    right: 2px;
}

[dir="rtl"] .tariff-toggle.yearly-active .tariff-toggle-slider {
    transform: translateX(-100%);
}

/* Preview tabs slider */
[dir="rtl"] .preview-tabs-slider {
    left: auto;
    right: 0;
}

/* Mobile overrides */
@media (max-width: 575.98px) {
    [dir="rtl"] .select-tariff-container .step-buttons .btn-back,
    [dir="rtl"] .preview-container .step-buttons .btn-back,
    [dir="rtl"] .select-stickers-container .step-buttons .btn-back,
    [dir="rtl"] .select-animations-container .step-buttons .btn-back {
        left: auto;
        right: var(--spacing-sm);
    }
}

/* ===============================================
   Upload modal (choice: SVG / text)
   =============================================== */
.upload-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 20px;
}
.upload-modal {
    background: #fff;
    border-radius: 20px;
    padding: 28px 20px 24px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.upload-modal-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 20px;
    color: #222;
}
.upload-modal-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.upload-modal-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 16px;
    border-radius: 16px;
    border: 2px solid #e8e8e8;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.upload-modal-card:hover {
    border-color: var(--accent-blue, #1a73e8);
    background: #f0f6ff;
}
.upload-modal-card:active {
    transform: scale(0.97);
}
.upload-modal-lottie {
    width: 120px;
    height: 120px;
    margin: 0 auto 4px;
    pointer-events: none;
}
.upload-modal-card-title {
    font-size: 15px;
    font-weight: 400;
    color: #444;
}

/* ===============================================
   Preview text page
   =============================================== */
.preview-text-container {
    padding-top: calc(80px + var(--safe-area-top, 0px));
    padding-bottom: 100px;
    position: relative;
}
.preview-text-container .preview-steps-wrapper {
    position: relative;
    overflow: hidden;
    min-height: 340px;
}
.preview-text-container .preview-step {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.preview-text-container .preview-step.active {
    position: relative;
    opacity: 1;
    pointer-events: auto;
}

.preview-text-body {
    padding: 0 8px 100px;
}

/* Text preview area */
.text-preview-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    max-height: 40vh;
    overflow: hidden;
    padding: 24px 24px;
    margin: 0 auto 12px;
    max-width: 480px;
    border-radius: 16px;
}
.text-preview-bg {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    border: 4px solid #A8A8A8;
    background: #E6E6E6;
    transition: background 0.3s, border-color 0.3s;
    pointer-events: none;
}
.text-preview-inner {
    position: relative;
    z-index: 1;
    white-space: nowrap;
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(28px, 8vw, 48px);
    line-height: 1.1;
    text-align: center;
    transform-origin: center center;
    display: inline-block;
    transition: transform 0.2s, color 0.2s;
}

/* Horizontal scroll row for color circles */
.color-row-scroll {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 8px 16px;
    max-width: 480px;
    margin: 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.color-row-scroll::-webkit-scrollbar {
    display: none;
}
.text-word {
    display: inline;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: border-color 0.2s, background 0.2s;
    user-select: none;
    -webkit-user-select: none;
}
.text-word:hover {
    background: rgba(26, 115, 232, 0.06);
}
.text-word.selected {
    border-color: var(--accent-blue, #1a73e8);
    background: rgba(26, 115, 232, 0.08);
}

.text-preview-hint {
    text-align: center;
    font-size: 13px;
    color: #999;
    margin: 0 0 16px;
}

/* Change text link */
.change-text-link-wrapper {
    text-align: center;
    margin-top: 16px;
    padding-bottom: 8px;
}
.change-text-link {
    font-size: 14px;
    color: var(--accent-blue, #1a73e8);
    text-decoration: none;
    font-weight: 500;
}
.change-text-link:hover {
    text-decoration: underline;
}

.switch-mode-link-wrapper {
    text-align: center;
    margin-top: 18px;
    padding-bottom: 8px;
}

/* Text presets */
.text-presets {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 0 auto 8px;
    max-width: 480px;
}
.text-preset-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.text-preset-btn:hover {
    background: #e4e4e4;
    border-color: #ccc;
}
.text-preset-btn:active {
    background: var(--accent-blue, #1a73e8);
    color: #fff;
    border-color: var(--accent-blue, #1a73e8);
}

/* Custom colors toggle */
.custom-colors-toggle-wrapper {
    text-align: center;
    margin: 14px auto 8px;
}
.custom-colors-toggle-btn {
    background: none;
    border: none;
    color: var(--accent-blue, #1a73e8);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.custom-colors-toggle-btn:hover {
    text-decoration: underline;
}
.custom-colors-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

/* Font settings panel */
.font-settings-panel {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 12px;
    transition: opacity 0.2s;
}

/* Weight selector */
.font-weight-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.font-weight-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 4px 8px;
    border-radius: 12px;
    border: 2px solid #e8e8e8;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.font-weight-option span {
    font-size: 22px;
    line-height: 1;
    color: #333;
}
.font-weight-option small {
    font-size: 9px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.font-weight-option:hover {
    border-color: #ccc;
    background: #f0f0f0;
}
.font-weight-option.active {
    border-color: var(--accent-blue, #1a73e8);
    background: rgba(26, 115, 232, 0.08);
}

/* Italic toggle */
.italic-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px;
}
.italic-toggle-label {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}
.italic-toggle {
    position: relative;
    width: 50px;
    height: 28px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}
.italic-toggle-track {
    display: block;
    width: 50px;
    height: 28px;
    border-radius: 14px;
    background: #ddd;
    transition: background 0.25s;
    position: relative;
}
.italic-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.25s;
}
.italic-toggle.active .italic-toggle-track {
    background: var(--accent-blue, #1a73e8);
}
.italic-toggle.active .italic-toggle-thumb {
    transform: translateX(22px);
}

/* Color templates */
.color-templates {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    padding: 8px 12px 20px;
    max-width: 480px;
    margin: 0 auto;
}
.color-template-circle {
    position: relative;
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid transparent;
    cursor: pointer;
    padding: 0;
    background: none;
    transition: border-color 0.2s, transform 0.15s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.color-template-circle:hover {
    transform: scale(1.1);
}
.color-template-circle:active {
    transform: scale(0.95);
}
.color-template-circle.active {
    border-color: var(--accent-blue, #1a73e8);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.3), 0 1px 4px rgba(0,0,0,0.12);
}
.ct-half {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
.ct-left {
    clip-path: polygon(0 0, 100% 0, 0 100%);
}
.ct-right {
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

/* Logo color circles */
.logo-color-circle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: border-color 0.2s, transform 0.15s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.logo-color-circle[data-color="#FFFFFF"] {
    border-color: #ddd;
}
.logo-color-circle:hover {
    transform: scale(1.1);
}
.logo-color-circle:active {
    transform: scale(0.95);
}
.logo-color-circle.active {
    border-color: var(--accent-blue, #1a73e8);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.3), 0 1px 4px rgba(0,0,0,0.12);
}

/* RTL support for preview_text */
[dir="rtl"] .text-preview-area {
    direction: rtl;
}
[dir="rtl"] .italic-toggle-row {
    flex-direction: row-reverse;
}
[dir="rtl"] .italic-toggle.active .italic-toggle-thumb {
    transform: translateX(-22px);
}