/* Local fonts from assets folder */
@font-face {
    font-family: 'PP Neue Montreal';
    src: url('./assets/ppneuemontreal-medium.woff2?v=21') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'PP Neue Montreal';
    src: url('./assets/ppneuemontreal-book.woff2?v=21') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Margarita script';
    src: url('./assets/Margarita script.woff2?v=21') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Splash loader overlay */
#splash {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: #FFFFFF;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

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

/* Простой красный спиннер */
.splash-spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid rgba(235, 59, 64, 0.2);
    border-top-color: #EB3B40;
    animation: splash-spin 0.9s linear infinite;
}

#splash.splash-hidden {
    opacity: 0;
    transition: opacity 0.36s ease;
    pointer-events: none;
}

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

#screen-formats,
#screen-payments,
#screen-processing {
    margin: 0;
}

/* Разрешаем скролл на экране форматов, чтобы контент не упирался в фиксированную кнопку */
#screen-formats { overflow: auto; }

#screen-landing {
    margin: 0;
}

main {
    margin: 0;
    padding: 0;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: var(--tg-viewport-stable-height, 100vh);
    overflow: hidden;
}

html, body {
    margin: 0;
    padding: 0;
    background: white;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

.screen {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    height: var(--tg-viewport-stable-height, 100vh);
    min-height: var(--tg-viewport-stable-height, 100vh);
    overflow: hidden;
}

/* Скрытие экранов */
.screen.hidden {
    display: none;
}

/* Первый экран (лендинг) */
.first-screen-container {
    width: 100vw;
    height: var(--tg-viewport-stable-height, 100vh);
    position: relative;
    background: white;
    background-image: url('./assets/1eee0889 1.png?v=21');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    overflow: hidden;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    margin-bottom: 0;
}

/* Вписываем макет 1080x1920 в экран по scale, как на втором экране */
.first-screen-stage {
    position: absolute;
    left: 0;
    top: 0;
    width: 1080px;
    height: 1920px;
    transform-origin: top left;
    transform: translate(var(--first-screen-offset-x, 0px), var(--first-screen-offset-y, 0px)) scale(var(--first-screen-scale, 1));
}

.first-screen-canvas {
    position: absolute;
    left: 0;
    top: 0;
    width: 1080px;
    height: 1920px;
}

.brand-letter {
    position: absolute;
    text-align: center;
    color: #EB3B40;
    font-size: 186.77px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 500;
    text-transform: lowercase;
    line-height: 166.22px;
    white-space: pre;
}

.brand-k { left: 291px; top: 82.80px; }
.brand-u { left: 383px; top: 83px; }
.brand-l { left: 460px; top: 82.80px; }
.brand-soft { left: 546px; top: 82.80px; }
.brand-t { left: 721px; top: 82.80px; }

.script-letter {
    position: absolute;
    text-align: center;
    color: #EB3B40;
    font-family: 'Margarita script', cursive;
    font-weight: 400;
}

.script-c {
    left: 98.64px; top: 56.09px;
    font-size: 309.50px; line-height: 275.46px; letter-spacing: 3.10px;
}
.script-p { left: 626.36px; top: 65.91px; font-size: 297.98px; line-height: 265.20px; }
.script-o { left: 798px; top: 66.50px; font-size: 297.98px; line-height: 265.20px; }
.script-r { left: 861px; top: 66.50px; font-size: 297.98px; line-height: 265.20px; }

.tagline-line1 {
    width: 598.91px;
    left: 238.54px;
    top: 274.55px;
    position: absolute;
    text-align: center;
    color: #EB3B40;
    font-size: 69.03px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 500;
    line-height: 62.12px;
}

.tagline-letter {
    position: absolute;
    text-align: center;
    color: #EB3B40;
    font-size: 69.03px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 500;
    line-height: 62.12px;
}
.tag-t { left: 307px; top: 337px; }
.tag-e { left: 337px; top: 337px; }
.tag-l { left: 373px; top: 337px; }
.tag-o { left: 407px; top: 337px; }
.tag-v { left: 457px; top: 336px; }

.tagline-script {
    left: 503.46px; top: 321.18px;
    position: absolute;
    text-align: center;
    color: #EB3B40;
    font-size: 130.79px;
    font-family: 'Margarita script', cursive;
    font-weight: 400;
    line-height: 117.71px;
}

.continue-button-home {
    width: calc(100% - 24px);
    height: 60px;
    left: 12px;
    bottom: 100px;
    position: fixed;
    background: white;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.continue-button-home .continue-button-text {
    color: black;
    font-size: 15.15px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 500;
    text-transform: uppercase;
    line-height: 14.69px;
}

/* стрелка для кнопок на 2 и 3 экране */
.continue-button-format .continue-button-arrow,
.continue-button-payment .continue-button-arrow {
    width: 16px;
    height: 16px;
    background-image: url('./assets/arrow.svg?v=21');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

/* стрелка для кнопки на первом экране (размер масштабируется скриптом) */
.continue-button-home .continue-button-arrow {
    width: 16px;
    height: 16px;
    background-image: url('./assets/arrow.svg?v=21');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

/* Белая стрелка только для кнопки оплаты */
.continue-button-payment .continue-button-arrow {
    background-image: url("data:image/svg+xml,%3Csvg width='13' height='13' viewBox='0 0 13 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 6.5H11.5M11.5 6.5L6 1M11.5 6.5L6 12' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E");
}

.continue-button-home:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.copyright-mark {
    left: 940.54px;
    top: 97.82px;
    position: absolute;
    color: #EB3B40;
    font-size: 28.19px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 500;
    line-height: 23.40px;
}

/* Стили для второго экрана - выбор формата */
.second-screen-container {
    width: 100vw;
    min-height: var(--tg-viewport-stable-height, 100vh);
    position: relative;
    background: white;
    overflow: visible;
    margin: 0;
    padding-top: 160px; /* резерв под прогресс-бар и заголовок */
    padding-bottom: 90px; /* запас под нативную Telegram Main Button */
}

/* Прогресс-бар */
.progress-container {
    position: absolute;
    left: 13px;
    right: 13px;
    top: 30px;
    display: flex;
    gap: 10px;
}

.progress-bar {
    flex: 1 1 0;
    height: 3px;
    background: black;
    opacity: 0.10;
}

.progress-bar.active {
    opacity: 0.40;
}

/* Заголовки */
.format-title-container {
    position: absolute;
    left: 13px;
    top: 60px;
}

.format-title {
    color: black;
    font-size: 44.63px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 400;
    line-height: 37.05px;
    margin-bottom: 0px;
}

.format-subtitle {
    color: black;
    font-size: 71.75px;
    font-family: 'Margarita script', cursive;
    font-weight: 400;
    line-height: 59.55px;
    margin-top: 0px;
}

/* Карточки каталога — компактная строка с явным чекбоксом (Hairline Select Row).
   Раскладка: [чекбокс] [тело: заголовок/описание/бейдж] [цена]. */
.format-cards {
    position: static;
    margin: 16px 13px 0 13px;
    width: auto;
}

/* Одна компактная кликабельная строка. Контур-хайрлайн — как везде в приложении. */
.format-card {
    width: 100%;
    min-height: 72px;                 /* тап-таргет с запасом (>=44px) */
    position: relative;
    overflow: hidden;
    outline: 0.40px black solid;
    outline-offset: -0.40px;
    border-radius: 0;
    margin-bottom: 10px;              /* плотнее прежних 15px */
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    display: flex;
    flex-direction: row;
    align-items: center;              /* центрируем чекбокс / тело / цену по вертикали */
    gap: 14px;
    padding: 12px 15px;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.format-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

.format-card:active {
    transform: translateY(0px);
}

/* Выбранное состояние №1 — вся карточка. */
.format-card.selected {
    outline: 2px solid #EB3B40;
    outline-offset: -1px;
    background: rgba(235, 59, 64, 0.05);
}

/* Чекбокс: ведущий слева, повторяет язык чекбокса оферты (.agree-checkbox):
   белый квадрат + чёрный хайрлайн; выбран → красная заливка + белая галка через ::after. */
.format-card-check {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: 1px #000000 solid;
    border-radius: 50%;               /* радио: выбор одного тарифа */
    background: #FFFFFF;
    position: relative;
    box-sizing: border-box;
    pointer-events: none;             /* кликабельна вся карточка, а не сам индикатор */
    transition: border-color 0.15s ease;
}

/* Выбранное состояние — красная точка внутри круга (радио). */
.format-card.selected .format-card-check {
    border-color: #EB3B40;
}

.format-card.selected .format-card-check::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #EB3B40;
    transform: translate(-50%, -50%);
}

/* Центральная колонка: заголовок + опц. приглушённое описание + бейдж «уже куплено». */
.format-card-body {
    flex: 1 1 auto;
    min-width: 0;                     /* критично для ellipsis внутри flex */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.format-card-title {
    color: #EB3B40;
    font-size: 26px;                  /* меньше прежних 32px ради компактной строки */
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 500;
    line-height: 28px;
    text-transform: lowercase;
    overflow-wrap: anywhere;          /* длинный заголовок переносится на новую строку */
}

.format-card-description {
    margin-top: 3px;
    color: #000000;
    font-size: 15px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 400;
    line-height: 17px;
    opacity: 0.55;                    /* приглушённый подзаголовок (иерархия) */
    overflow-wrap: break-word;        /* описание видно целиком, переносится на строки */
}

.format-card-price {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.old-price {
    color: #EB3B40;
    font-size: 14px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 400;
    opacity: 0.50;
    text-decoration: line-through;
    line-height: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
}

.current-price {
    color: #EB3B40;
    font-size: 26px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 400;
    line-height: 24px;
    display: inline-flex;
    align-items: baseline;
    gap: 0.16em;
}

/* «руб.» — компактный валютный суффикс. Зазор до числа задаётся через gap на
   flex-контейнере цены, поэтому он пропорционален размеру числа и одинаков везде
   (карточки/корзина/крупная сумма) — не «скачет». */
.rub {
    font-size: 0.56em;
}

/* Цена в корзине: число и «руб.» по общей базовой линии, тот же зазор */
.cart-price {
    display: inline-flex;
    align-items: baseline;
    gap: 0.16em;
}

/* Кнопка продолжить для второго экрана */
.continue-button-format {
    position: relative;
    width: calc(100% - 24px);
    height: 60px;
    margin: 16px 12px 24px 12px;
    background: white;
    overflow: hidden;
    outline: 1px black solid;
    outline-offset: -1px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.continue-button-format:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.continue-button-format .continue-button-text {
    color: black;
    font-size: 15.15px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 500;
    text-transform: uppercase;
    line-height: 14.69px;
    margin: 0;
}

/* Третий экран (оплата) */
.third-screen-container {
    width: 100vw;
    height: var(--tg-viewport-stable-height, 100vh);
    position: relative;
    background: white;
    overflow: auto;
    margin: 0;
}

.payment-title-container {
    position: static;
    margin: 48px 13px 0 13px;
}

.payment-title {
    color: black;
    font-size: 44.63px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 400;
    line-height: 37.05px;
}

.payment-subtitle {
    color: black;
    font-size: 71.75px;
    font-family: 'Margarita script', cursive;
    font-weight: 400;
    line-height: 59.55px;
}

/* Поля ввода */
.input-field {
    position: static;
    display: block;
    margin: 14px 13px 0 13px;
    width: calc(100% - 26px);
    background: #FFFFFF;
    border: 1px solid #000000;
    color: black;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 400;
    font-size: 24px;
    padding: 15px 12px;
    box-sizing: border-box;
    outline: none;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    border-radius: 0;
    -webkit-tap-highlight-color: transparent;
}

.input-field::placeholder {
    color: rgba(0,0,0,0.5);
}

/* Показываем текст ошибки внутри инпута красным, когда есть класс error */
.input-field.error::placeholder {
    color: #EB3B40;
    opacity: 1;
}

#email { display: block; }
#phone { display: block; }

.field-error {
    position: static;
    margin: 6px 13px 0 13px;
    color: #EB3B40;
    font-size: 12px;
    font-family: 'PP Neue Montreal', sans-serif;
}

#email-error { display: block; }
#phone-error { display: block; }

.input-field.error { border-color: #EB3B40; }
.input-field.active { border-color: #EB3B40; }
.input-field:focus { outline: none; box-shadow: none; }

/* Каталог: плашка загрузки + бейдж «уже куплено» на карточке */
.catalog-loading {
    margin: 24px 13px;
    text-align: center;
    color: #EB3B40;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 400;
    font-size: 18px;
}

.format-card-note {
    margin-top: 5px;
    align-self: flex-start;
    color: #FFFFFF;
    background: #EB3B40;
    padding: 1px 7px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 400;
    font-size: 11px;
    line-height: 15px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Корзина: список выбранных программ на экране оплаты */
.cart-summary {
    margin: 16px 13px 0 13px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cart-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    color: black;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 20px;
}

.cart-row span:first-child {
    text-transform: lowercase;
}

/* Бонусные баллы: статус слева + красная кнопка «использовать» справа */
.bonus-row {
    margin: 16px 13px 0 13px;
    display: flex;
    gap: 12px;
}

.bonus-row .bonus-info,
.bonus-row .bonus-apply {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    text-transform: uppercase;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 500;
    font-size: 15.15px;
    line-height: 14.69px;
    box-sizing: border-box;
}

.bonus-info {
    flex: 1 1 auto;
    color: #EB3B40;
    outline: 1px #EB3B40 solid;
    outline-offset: -1px;
    background: #FFFFFF;
}

.bonus-apply {
    flex: 0 0 188px;
    background: #EB3B40;
    color: #FFFFFF;
    outline: 1px #EB3B40 solid;
    outline-offset: -1px;
    border-radius: 0;
    cursor: pointer;
}

.bonus-apply[disabled],
.bonus-apply.disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* Согласие с офертой */
.agreement {
    position: static;
    margin: 14px 13px 0 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.agree-checkbox {
    width: 34px;
    height: 34px;
    border: 1px #000000 solid;
    border-radius: 0;
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    background: #FFFFFF;
    position: relative;
    outline: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
}

.agree-checkbox:checked { background: #EB3B40; border-color: #EB3B40; }
.agree-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 10px;
    height: 16px;
    border: 2px solid #FFFFFF;
    border-top: 0;
    border-left: 0;
    transform: translate(-50%, -62%) rotate(45deg);
    transform-origin: center;
}


.agree-label {
    color: black;
    font-size: 19px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 400;
    line-height: 23px;
    position: relative;
    margin: 0;
    letter-spacing: -0.2px;
}

.offer-link { color: #EB3B40; text-decoration: underline; }

/* Кнопка продолжить третьего экрана */
.continue-button-payment {
    position: relative;
    width: calc(100% - 24px);
    height: 66px;
    margin: 14px 13px 0 13px;
    background: #EB3B40;
    overflow: hidden;
    outline: none;
    cursor: pointer;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.continue-button-payment .continue-button-text {
    color: white;
    font-size: 18px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 500;
    text-transform: uppercase;
    line-height: 17px;
    margin: 0;
}

/* удалено пустое правило .continue-button-payment .continue-button-arrow */

/* Четвёртый экран — платёж обрабатывается */
.fourth-screen-container {
    width: 100vw;
    height: var(--tg-viewport-stable-height, 100vh);
    position: relative;
    background: white;
    overflow: hidden;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    margin-bottom: 0;
}

/* Вписываем макет четвёртого экрана по scale, как на первом экране (базовый холст 440x956) */
.processing-stage {
    position: absolute;
    left: 0;
    top: 0;
    width: 440px;
    height: 956px;
    transform-origin: top left;
    transform: translate(var(--processing-offset-x, 0px), var(--processing-offset-y, 0px)) scale(var(--processing-scale, 1));
}

/* Используем существующий progress-container; для согласованности просто добавили класс processing */
.progress-container.processing {
    position: absolute;
    left: 13px;
    right: 13px;
    top: 30px; /* как на 2 и 3 экранах */
}

.processing-loader {
    position: absolute;
    left: 164px;
    top: 336px;
    width: 112px;
    height: 158px;
}

.processing-title {
    width: 330px;
    left: 55px;
    top: 516px;
    position: absolute;
    text-align: center;
    color: black;
    font-size: 44.63px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 400;
    line-height: 41.51px;
}

.processing-subtitle {
    width: 242px;
    left: 99px;
    top: 615px;
    position: absolute;
    opacity: 0.40;
    text-align: center;
    color: black;
    font-size: 19.41px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 500;
    line-height: 23.87px;
}

/* Убираем внешние отступы у секции четвёртого экрана, чтобы не было вертикального скролла */
#screen-processing { margin: 0; min-height: var(--tg-viewport-stable-height, 100vh); overflow: hidden; }

/* Цена и примечание на экране оплаты */
.payment-amount {
    position: static;
    margin: 16px 13px 0 13px;
    color: #EB3B40;
    font-size: 57.81px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 400;
    line-height: 47.98px;
    display: flex;
    align-items: baseline;
    gap: 0.16em;
}

.payment-amount .amount-currency { font-size: 0.44em; }

.payment-note {
    position: static;
    margin: 16px 13px 24px 13px;
    display: grid;
    grid-template-columns: 22px 1fr;
    align-items: center;
    column-gap: 6px;
    color: black;
    font-size: clamp(16px, 4.5vw, 19.58px);
    font-family: 'PP Neue Montreal', sans-serif;
    white-space: nowrap;
}

/* Выравнивание текста по высоте с иконкой в примечании оплаты */
.payment-note-icon { color: #EB3B40; display: flex; align-items: center; height: 22px; }
.payment-note-icon svg { display: block; width: 22px; height: 22px; }
.payment-note .note-text { line-height: 22px; }

/* Secondary payment button style */
.continue-button-payment.secondary {
    background: white;
    outline: 1px #EB3B40 solid;
    outline-offset: -1px;
    margin-top: 12px; /* space between buttons */
}

.continue-button-payment.secondary .continue-button-text {
    color: #EB3B40;
}

.continue-button-payment.secondary .continue-button-arrow {
    background-image: url("data:image/svg+xml,%3Csvg width='13' height='13' viewBox='0 0 13 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 6.5H11.5M11.5 6.5L6 1M11.5 6.5L6 12' stroke='%23EB3B40' stroke-width='1.5'/%3E%3C/svg%3E");
}

/* CTA вынесен в нативную Telegram Main Button — внутренние кнопки «Продолжить» скрыты */
.continue-button-home,
.continue-button-format {
    display: none !important;
}
