/* CTA: use the medium composition before the illustration reaches the text. */
@media (max-width: 1360px) {
    .cta { padding: 24px; }
    .cta__content { width: 363px; gap: 16px; }
    .cta__title { font-size: 32px; }
    .cta__tag, .cta__link { font-size: var(--b1); }
    .cta__deco--q-big { width: 231px; height: 229px; right: 51px; top: 34px; }
    .cta__deco--q-1 { width: 123px; height: 122px; right: -10px; top: 131px; }
    .cta__deco--q-2 { width: 123px; height: 122px; right: 199px; top: 131px; }
    .cta__deco--glow { width: 398px; height: 403px; right: -164px; top: -28px; }
}

/* Large / small desktop --------------------------------------------------- */
@media (max-width: 1200px) {
    :root {
        --pad-x: 64px;
        --gap-section: 48px;
        --h1: 44px;
    }
    .block-stack { gap: 96px; }
    .adv-row__media { width: 460px; height: 460px; }
    .adv-row__media .glow { width: 330px; height: 334px; }
    .adv-row__media img { width: 340px; height: 340px; }

    .faq-section { flex-direction: column; align-items: stretch; padding: 24px; gap: 16px; }
    .faq-section__side { width: 100%; gap: 8px; }
    .faq-section__icon { display: none; }
    .faq-card { padding: 24px; }
    .faq-promo--wide { display: none; }
    .faq-section__intro, .faq-step__text, .faq-card, .faq-callout p { font-size: 16px; }

    .pay-hero__panel { padding: 48px; }
    .pay-hero__deco--coin { display: none; }
}

/* Narrow desktop: the text column is too narrow for three steps in a row */
@media (max-width: 1100px) {
    .pay-steps { flex-direction: column; gap: 16px; }
    .pay-step { flex-direction: row; align-items: center; text-align: left; }
}

@media (max-width: 900px) {
    /* advantages shrink but keep side by side */
    .adv-row { gap: 32px; }
    .adv-row__media { width: 340px; height: 340px; }
    .adv-row__media .glow { width: 250px; height: 253px; }
    .adv-row__media img { width: 260px; height: 260px; }
    .advantages__rows { gap: 32px; }
}

@media (min-width: 745px) and (max-width: 1100px) {
    .other-card { flex-basis: calc((100% - 16px) / 3); min-width: 0; }
}

/* Payment hero: text + card stack --------------------------------------- */
@media (max-width: 900px) {
    .pay-hero__panel { flex-direction: column; align-items: stretch; padding: 48px; gap: 24px; }
    .pay-hero__text { flex: none; width: 100%; justify-content: flex-start; gap: 24px; }
    .pay-steps { flex-direction: row; gap: 24px; }
    .pay-step { flex-direction: column; align-items: center; text-align: center; }
    .pay-card { min-width: 0; padding: 6px 16px 24px; }
    .pay-hero__deco--coin, .pay-hero__deco--check, .pay-hero__deco--mail { display: none; }
    .pay-hero__title-break { display: none; }
    .pay-hero__glow { right: auto; top: auto; left: 50%; bottom: -508.5px; transform: translateX(-50%) rotate(45deg); }

    /* banners stay side by side */
    .pay-banner { min-width: 0; }
    .pay-banner__deco--card { right: -139px; }
    .pay-banner__glow--card { right: -562px; top: calc(50% + 84.25px); }

    /* max banner */
    .tg__deco--mail { display: none; }
    .tg__deco--box { display: none; }
    .tg__deco--check {
        display: block;
        width: 76px;
        left: 62.2%;
        margin-left: -163px;
        bottom: 10px;
        transform: rotate(-15deg);
    }
    .tg__deco--icon {
        width: 120px;
        left: auto;
        right: 20px;
        margin-left: 0;
        bottom: 20px;
    }
    .tg__deco--card {
        left: 62.2%;
        margin-left: -100px;
        width: 300px;
    }
    .tg__glow--1 {
        left: 79.8%;
        margin-left: -200px;
        bottom: -150px;
    }
    .tg__glow--2 { display: none; }
    .tg__glow--3 { display: none; }
    .tg__glow--4{ display: none; }
}

/* ==========================================================================
   Tablet
   ========================================================================== */
@media (max-width: 744px) {
    :root {
        --pad-x: 24px;
        --gap-section: 40px;
        --h1: 40px;
        --h2: 32px;
        --h3: 28px;
    }

    /* nav -> hamburger */
    .nav-toggle { display: block; }
    .site-header__inner { position: relative; }
    .site-nav {
        position: absolute;
        top: 100%;
        right: var(--pad-x);
        left: var(--pad-x);
        background: var(--color-white);
        border: 1px solid #eceaf3;
        border-radius: var(--radius-md);
        box-shadow: 0 12px 30px rgba(28, 34, 50, .12);
        padding: 8px 16px;
        display: none;
        z-index: 40;
    }
    .site-nav.is-open { display: block; }
    .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
    .site-nav a { padding: 12px 0; }

    /* bento: app + telegram stack full width */
    .bento__card--app { flex-basis: 100%; min-width: 100%; }

    .block-stack { gap: 64px; }

    /* services -> 2 columns */
    .service-card { flex-basis: calc(50% - 4px); }

    /* other -> 3 per row */
    .other-card { flex-basis: calc(33.333% - 6px); min-width: 0; }

    /* app card phone smaller */
    .app-card__phone { width: 240px; right: 16px; }
    .error-page { padding: 48px var(--pad-x); gap: 24px; --h1: 36px; --b2: 14px; }

    .text-page { padding-top: 40px; padding-bottom: 40px; }
    .text-page__body table { width: 100% !important; }
    .text-page__body col,
    .text-page__body th,
    .text-page__body td { width: auto !important; }
    .text-page__body th,
    .text-page__body td { padding: 6px 8px; }

    .app-card__phone {
        right: 64px;
    }
    .app-card__deco--check { right: 26px; }
    .app-card__deco--cube { right: 280px; bottom: 55px; }
    .app-card__deco--mail {
        width: 153px;
        right: -50px;
        bottom: -16px;
    }
}

@media (max-width: 720px) {
    .session-card { flex-direction: column; gap: 24px; padding: 24px; }
    /* CTA stack */
    .cta { flex-direction: column; gap: 72px; padding: 16px 16px 0; min-height: 643px; }
    .cta__content { width: 100%; gap: 12px; }
    .cta__title { font-size: 28px; }
    .cta__decorations { flex: none; align-self: center; margin-top: auto; width: 374px; height: 268px; }
    .cta__deco--glow {
        right: auto;
        top: 82px;
        left: 50%;
        transform: translateX(-50%) rotate(45deg);
    }
    .cta__deco--q-big { left: 54px; right: auto; top: 10px; }
    .cta__deco--q-1 { left: 223px; right: auto; top: 107px; }
    .cta__deco--q-2 { left: 14px; right: auto; top: 107px; }
}

@media (max-width: 680px) {
    .tg__deco--check { width: 64px; margin-left: -150px; bottom: 0; }

    /* advantages stack, image on top */
    .adv-row { flex-direction: column; gap: 16px; text-align: left; }
    .adv-row + .adv-row { margin-top: 0; }
    .adv-row__media { order: -1; width: 260px; height: 260px; align-self: center; }
    .adv-row__media .glow { width: 190px; height: 192px; }
    .adv-row__media img { width: 210px; height: 210px; }
    .adv-row__text { width: 100%; }
}

/* ==========================================================================
   Mobile
   ========================================================================== */
@media (max-width: 560px) {
    .session-card { padding: 16px; }
    .session-card__form { padding: 16px; }
    .session-details > div { flex-direction: column; }
    .message-session__sender { font-size: var(--b2); }
    .message-session .store-badge { width: calc(50% - 4px); padding: 0 8px; gap: 5px; font-size: 13px; }
    :root {
        --pad-x: 16px;
        --gap-section: 32px;
        --h1: 32px;
        --h2: 26px;
        --h3: 24px;
        --h4: 20px;
    }

    /* bento single column with figma mobile order */
    .bento { flex-direction: column; }
    .bento__col { display: contents; }
    .bento__card {
        width: 100%;
        min-width: 0;
        flex-basis: auto;
        height: auto;
    }
    .bento__card--topup    { order: 1; min-height: 152px; }
    .bento__card--autopay  { order: 2; min-height: 152px; }
    .bento__card--balance  { order: 3; min-height: 152px; }
    .bento__card--app      { order: 4; }
    .bento__card--max { order: 5; min-height: 160px; }

    .bento__card--balance .bento__img { width: 150px; height: 150px; left: auto; right: -10px; bottom: -30px; }
    .bento__card--topup   .bento__img { width: 240px; height: 240px; right: -50px; }

    /* mobile-app card: overlapping phone composition matching Figma node 7069:3457 */
    .bento__card--app { align-items: center; justify-content: flex-start; gap: 12px; text-align: center; padding-bottom: 0; min-height: 520px; }
    .app-card__head, .app-badges { align-self: center; }
    .app-badges { justify-content: center; }
    .app-card__phone {
        left: 50%;
        right: auto;
        bottom: -212px;
        width: 238px;
        margin: 0;
        transform: translateX(-50%);
    }
    .app-card__deco--check {
        left: calc(50% + 119.5px);
        right: auto;
        top: auto;
        bottom: 196px;
        width: 89px;
        transform: translateX(-50%);
    }
    .app-card__deco--cube {
        left: calc(50% - 243.9px);
        right: auto;
        bottom: 65px;
        width: 153px;
    }
    .app-card__deco--mail {
        left: calc(50% + 155px);
        right: auto;
        bottom: -32px;
        width: 162px;
        transform: translateX(-50%);
    }

    .block-stack {
        gap: 32px;
        padding-bottom: 0;
    }
    .other {
        gap: 12px;
    }

    /* deco compact */
    .tg__glow--1 {
        display: block;
        margin-left: -100px;
    }
    .tg__deco--icon { display: none; }
    .tg__deco--check { display: none; }
    .tg__deco--box  { width: 120px; left: auto; right: 6px;   margin-left: 0; bottom: -30px; }
    .tg__deco--mail { display: none; }
    .tg__deco--card {
        margin-left: -10px;
        width: 160px;
        bottom: -50px;
    }

    /* services -> single column, horizontal card */
    .service-card {
        flex-basis: 100%;
        flex-direction: row;
        align-items: center;
        gap: 16px;
    }
    .service-card__icon { width: 80px; height: 80px; flex-shrink: 0; }
    .service-card__body { display: flex; flex-direction: column; gap: 8px; }

    /* other -> 2 per row */
    .other-card { flex-basis: calc(50% - 4px); }

    /* payment page: steps become icon+text rows, banners stack, no hero decor */
    .pay-hero__panel { padding: 16px; gap: 16px; }
    .pay-hero__glow { display: none; }
    .pay-steps { flex-direction: column; gap: 24px; margin-top: 24px; margin-bottom: 24px; }
    .pay-step { flex-direction: row; align-items: center; text-align: left; gap: 12px; }
    .pay-card { padding: 6px 12px 16px; }
    .pay-tabs__tab { font-size: 13px; }
    .pay-hero__deco--mail { display: none; }
    .pay-banners { flex-direction: column; }
    .pay-banner { min-width: 0; }
    .pay-banner__deco--card { right: -76px; }
    .pay-banner__glow--card { right: -488px; top: calc(50% + 86.25px); }
    .pay-banner--card h3 { letter-spacing: -0.5px; }

    /* payment confirmation card: rows/method stack, buttons go full-width */
    .confirm-card { padding: 24px; --b2: 14px; --h2: 28px; }
    .confirm-row { flex-direction: column; gap: 4px; }
    .confirm-row__label { width: 100%; }
    .confirm-method { flex-direction: column; gap: 4px; }
    .confirm-method__label { width: 100%; }
    .confirm-radios { gap: 4px; }
    .confirm-actions { flex-direction: column; gap: 16px; }
    .confirm-btn { width: 100%; font-size: 14px; }

    /* success/subscription-cancel card: icon+close move to their own top row,
       body (title/text/actions) drops to a full-width row below */
    .success-card {
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "icon . close"
            "body body body";
        gap: 16px;
        padding: 24px;
        --b2: 14px;
        --h2: 28px;
    }
    .success-card__icon { width: 72px; height: 72px; }
    .success-card__actions { flex-direction: column; }
    .success-card__actions .confirm-btn { width: 100%; font-size: 14px; }

    /* error pages (404/500): tighter side padding than the site default, and the
       button goes full-width */
    .error-page { padding: 32px 8px; gap: 16px; --h1: 32px; --b2: 14px; }
    .error-page__btn { width: 100%; }

    /* faq: tighter card padding, steps/callouts shrink text, buttons stack full-width */
    .faq-section { padding: 24px; gap: 16px; }
    .faq-section__intro, .faq-step__text, .faq-card, .faq-callout p { font-size: 14px; }
    .faq-step { padding: 16px; gap: 12px; }
    .faq-card { padding: 16px; gap: 16px; }
    .faq-actions { flex-direction: column; }
    .faq-btn { width: 100%; }
    .faq-tab { font-size: 13px; padding: 6px 12px; }
    /* stacked, the cards take their content's height — flex: 1 1 0 would pin them
       to min-height and clip what doesn't fit */
    .faq-promo-row { flex-direction: column; }
    .faq-promo-row .faq-promo { flex: none; }
    /* The promo sits inside a step's text column, ~170px wide on a phone: compact
       badges in two columns while they fit, one column once they don't */
    .faq-promo__badges {
        width: 100%;
        max-width: 188px; /* never a third column */
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(88px, max-content));
        gap: 4px;
    }
    .store-badge--sm { width: auto; height: 27px; padding: 0 7px; gap: 4px; border-radius: 9px; font-size: 11px; }
    .store-badge--sm.store-badge--google-play .store-badge__icon { width: 14px; height: 16.35px; }
    .store-badge--sm.store-badge--app-store   .store-badge__icon { width: 12px; height: 13.68px; }
    .store-badge--sm.store-badge--rustore     .store-badge__icon { width: 16px; height: 16px; }
    .store-badge--sm.store-badge--appgallery  .store-badge__icon { width: 16px; height: 16px; }

    /* bonus Telegram-bot promo: drop to the same compact single-image look as the
       small faq-promo--max card used elsewhere on this page */
    .faq-promo--large .faq-promo__check-2,
    .faq-promo--large .faq-promo__max { display: none; }
    .faq-promo--large .faq-promo__bot { width: 130px; right: -10px; bottom: -20px; }

    /* mobile-only app-chat-2.png swap (via <picture>) has a very different aspect
       ratio (95x174 vs the desktop asset's 474x573) — needs its own size/position */
    .faq-promo__phone { width: 95px;  top: 24px; }
    .faq-promo__check { right: 74px; top: 12px; }

    .faq-promo--large .faq-promo__glow {
        left: calc(70% + 129px);
    }
    .faq-promo__sub { font-size: 14px; }
}
