/* ==========================================================================
   Paywall & внутренняя валюта «Искры»
   Стиль — книжная иллюминированная страница (как в Sir Brante): пергамент,
   золотая фольга, тёплый контраст. Иерархия по мировым best-practices:
   ценность → якорь-цена → один яркий CTA → честный выход.
   ========================================================================== */

/* --- Виджеты баланса (меню / setup / чат) --- */
.billing-widget {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin: 12px 0 18px;
    color: #3d2515;
    font-family: 'Alegreya Sans', sans-serif;
}

.billing-widget-text {
    font-size: 15px;
    color: rgba(48, 28, 13, 0.82);
}

.billing-widget-btn,
.btn-billing-chip {
    border: 1px solid rgba(105, 66, 35, 0.42);
    background: rgba(244, 228, 190, 0.9);
    color: #3b2414;
    border-radius: 8px;
    padding: 7px 12px;
    font-family: 'Alegreya Sans', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.billing-widget-btn:hover,
.btn-billing-chip:hover {
    background: rgba(252, 240, 208, 1);
    border-color: rgba(120, 78, 38, 0.7);
}

.btn-billing-chip {
    min-height: 34px;
    white-space: nowrap;
}

/* --- Затемнение фона --- */
.paywall-overlay {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(120% 80% at 50% 0%, rgba(221, 173, 82, 0.18), transparent 46%),
        rgba(10, 6, 3, 0.86);
    backdrop-filter: blur(5px);
    animation: paywallFade 0.22s ease;
}

@keyframes paywallFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.paywall-overlay.hidden {
    display: none;
}

/* --- Карточка --- */
.paywall-card {
    position: relative;
    width: min(468px, 100%);
    max-height: min(92vh, 920px);
    overflow: auto;
    padding: clamp(26px, 4.5vw, 38px) clamp(22px, 4vw, 36px) clamp(20px, 3.5vw, 30px);
    border-radius: 16px;
    /* двойная «иллюминированная» рамка: золотая обводка + пергамент */
    border: 1px solid rgba(150, 106, 48, 0.55);
    background:
        linear-gradient(180deg, rgba(252, 243, 216, 0.99), rgba(241, 222, 174, 0.99));
    color: #2d1a0f;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.55),
        inset 0 0 0 1px rgba(255, 252, 240, 0.6),
        inset 0 0 0 6px rgba(186, 142, 72, 0.16);
    font-family: 'Alegreya Sans', sans-serif;
    animation: paywallRise 0.26s cubic-bezier(0.21, 0.8, 0.3, 1);
}

@keyframes paywallRise {
    from { transform: translateY(14px) scale(0.985); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

.paywall-close {
    position: absolute;
    right: 14px;
    top: 14px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(69, 39, 19, 0.28);
    border-radius: 999px;
    background: rgba(255, 250, 232, 0.7);
    color: #5a3315;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.16s ease, transform 0.16s ease;
}

.paywall-close:hover {
    background: rgba(255, 250, 232, 1);
    transform: rotate(90deg);
}

/* --- Шапка --- */
.paywall-eyebrow {
    margin: 0 0 9px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #8a4a22;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.paywall-eyebrow::before {
    content: "✦";
    color: #b88a3c;
    font-size: 13px;
}

.paywall-title {
    margin: 0 0 12px;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: clamp(28px, 6.4vw, 40px);
    line-height: 1.05;
    color: #3a210f;
    text-shadow: 0 1px 0 rgba(255, 250, 235, 0.6);
}

.paywall-copy {
    margin: 0 0 18px;
    max-width: 42ch;
    font-size: 16px;
    line-height: 1.5;
    color: rgba(45, 26, 15, 0.86);
}

/* --- Буллеты ценности --- */
.paywall-bullets {
    list-style: none;
    margin: 0 0 22px;
    padding: 0;
    display: grid;
    gap: 10px;
}

.paywall-bullet {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 15.5px;
    line-height: 1.4;
    color: rgba(45, 26, 15, 0.9);
}

.paywall-bullet::before {
    content: "✦";
    flex: none;
    margin-top: 1px;
    color: #b1813a;
    font-size: 14px;
}

/* --- Геро-оффер --- */
.paywall-offer-hero {
    position: relative;
    margin: 0 0 14px;
    padding: 26px 22px 22px;
    border-radius: 13px;
    border: 1.5px solid rgba(150, 106, 48, 0.5);
    background:
        radial-gradient(120% 100% at 50% 0%, rgba(255, 246, 218, 0.9), transparent 60%),
        linear-gradient(180deg, rgba(255, 249, 230, 0.96), rgba(247, 232, 192, 0.96));
    box-shadow:
        0 12px 30px rgba(96, 60, 22, 0.16),
        inset 0 0 0 1px rgba(255, 255, 248, 0.5);
}

.paywall-badge {
    position: absolute;
    top: -13px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    padding: 6px 16px;
    border-radius: 999px;
    background: linear-gradient(180deg, #7a4a22, #5e3417);
    color: #ffe9b8;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(70, 40, 16, 0.4), inset 0 1px 0 rgba(255, 220, 150, 0.4);
}

.paywall-offer-title {
    margin: 2px 0 4px;
    font-family: 'Cinzel', serif;
    font-size: 22px;
    font-weight: 700;
    color: #3a210f;
    text-align: center;
}

.paywall-offer-subtitle {
    margin: 0 0 16px;
    font-size: 14.5px;
    color: rgba(45, 26, 15, 0.66);
    text-align: center;
}

/* Цена */
.paywall-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 4px;
}

.paywall-old-price {
    text-decoration: line-through;
    text-decoration-color: rgba(122, 38, 23, 0.6);
    color: rgba(45, 26, 15, 0.5);
    font-size: 19px;
}

.paywall-new-price {
    font-family: 'Cinzel', serif;
    font-size: 42px;
    font-weight: 700;
    line-height: 1;
    color: #3a210f;
}

.paywall-discount {
    align-self: center;
    padding: 3px 9px;
    border-radius: 7px;
    background: rgba(122, 38, 23, 0.12);
    color: #8a2a18;
    font-size: 14px;
    font-weight: 800;
}

.paywall-estimate {
    margin: 0 0 18px;
    font-size: 14px;
    color: rgba(45, 26, 15, 0.62);
    text-align: center;
}

/* --- Кнопки --- */
.paywall-buy,
.paywall-secondary,
.paywall-exit {
    width: 100%;
    border-radius: 10px;
    font-family: 'Alegreya Sans', sans-serif;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.paywall-buy {
    min-height: 54px;
    border: none;
    font-size: 18px;
    background: linear-gradient(180deg, #5a3014, #45230f);
    color: #ffeec8;
    box-shadow: 0 10px 24px rgba(60, 32, 12, 0.4), inset 0 1px 0 rgba(255, 215, 150, 0.28);
}

.paywall-buy:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(60, 32, 12, 0.46), inset 0 1px 0 rgba(255, 215, 150, 0.32);
}

.paywall-buy:active {
    transform: translateY(0);
}

.paywall-reassure {
    margin: 11px 0 0;
    font-size: 13px;
    color: rgba(45, 26, 15, 0.6);
    text-align: center;
}

.paywall-reassure::before {
    content: "🔒 ";
    font-size: 11px;
}

.paywall-secondary {
    min-height: 42px;
    margin-top: 14px;
    border: none;
    background: transparent;
    color: #6a3c1e;
    font-size: 15px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(106, 60, 30, 0.4);
}

.paywall-secondary:hover {
    color: #4a2813;
}

/* Прочие тарифы */
.paywall-plans {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.paywall-plans.hidden {
    display: none;
}

.paywall-offer {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 4px 14px;
    padding: 14px 16px;
    border: 1px solid rgba(120, 80, 40, 0.28);
    border-radius: 11px;
    background: rgba(255, 250, 232, 0.66);
    transition: border-color 0.16s ease, background 0.16s ease;
}

.paywall-offer:hover {
    border-color: rgba(120, 80, 40, 0.5);
    background: rgba(255, 250, 232, 0.92);
}

.paywall-offer .paywall-offer-title {
    margin: 0;
    font-size: 17px;
    text-align: left;
}

.paywall-offer .paywall-offer-subtitle {
    margin: 2px 0 0;
    grid-column: 1;
    text-align: left;
}

.paywall-offer .paywall-price {
    grid-column: 2;
    grid-row: 1 / 3;
    justify-content: flex-end;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    margin: 0;
}

.paywall-offer .paywall-new-price {
    font-size: 24px;
}

.paywall-offer .paywall-old-price {
    font-size: 14px;
}

.paywall-offer .paywall-buy {
    grid-column: 1 / -1;
    min-height: 44px;
    margin-top: 10px;
    font-size: 16px;
    background: linear-gradient(180deg, #6a3c1e, #4f2a14);
}

/* Сноска про переменную цену хода */
.paywall-note {
    margin: 16px 0 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: rgba(45, 26, 15, 0.52);
    text-align: center;
}

.paywall-message {
    min-height: 0;
    margin: 12px 0 0;
    color: #7a2a16;
    font-weight: 700;
    text-align: center;
}

.paywall-message:empty {
    margin: 0;
}

/* Честный выход */
.paywall-exit {
    min-height: 46px;
    margin-top: 16px;
    border: 1px solid rgba(106, 60, 30, 0.32);
    background: rgba(255, 250, 232, 0.4);
    color: rgba(74, 42, 20, 0.9);
    font-size: 15px;
    font-weight: 700;
}

.paywall-exit:hover {
    background: rgba(255, 250, 232, 0.85);
    border-color: rgba(106, 60, 30, 0.5);
}

/* --- Мобайл: bottom-sheet --- */
@media (max-width: 560px) {
    .paywall-overlay {
        padding: 0;
        align-items: end;
        backdrop-filter: blur(3px);
    }

    .paywall-card {
        width: 100%;
        max-height: 94vh;
        border-radius: 18px 18px 0 0;
        padding: 26px 18px 22px;
        animation: paywallSheet 0.28s cubic-bezier(0.21, 0.8, 0.3, 1);
    }

    @keyframes paywallSheet {
        from { transform: translateY(40px); opacity: 0.4; }
        to   { transform: translateY(0); opacity: 1; }
    }

    .paywall-new-price {
        font-size: 38px;
    }

    .paywall-offer {
        grid-template-columns: 1fr;
    }

    .paywall-offer .paywall-price {
        grid-column: 1;
        grid-row: auto;
        flex-direction: row;
        align-items: baseline;
        justify-content: flex-start;
        margin-top: 6px;
    }
}

/* --- Поле e-mail для чека --- */
.paywall-email {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 14px 0 4px;
}

.paywall-email-label {
    font-size: 13px;
    letter-spacing: 0.02em;
    color: rgba(255, 250, 232, 0.7);
}

.paywall-email-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    font-size: 16px;
    color: rgba(255, 250, 232, 1);
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 250, 232, 0.22);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.16s ease, background 0.16s ease;
}

.paywall-email-input::placeholder {
    color: rgba(255, 250, 232, 0.35);
}

.paywall-email-input:focus {
    border-color: rgba(255, 250, 232, 0.55);
    background: rgba(0, 0, 0, 0.3);
}
