/* Layout repairs for phones, tablets and odd screen sizes (2026-11-14 audit: 114 pages x 14 screen sizes).
   No redesign: nothing here changes colours, type or structure, it only stops things from being cut,
   squeezed or pushed off the screen. Loaded last on every page. Rollback = remove this file's <link>. */

/* ══ iOS Safari ═══════════════════════════════════════════════════════════════════════════════════ */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; }

/* A focused field under 16px makes Safari zoom the page and leave it zoomed and shifted sideways. */
@supports (-webkit-touch-callout: none) {
    input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]):not([type=submit]):not([type=button]):not(.otp-input):not(#topupModalAmount),
    select, textarea { font-size: 16px !important; }
    .tp-gift input { width: 100%; }
    /* the buy bar and the cookie banner must not sit in the home-indicator strip */
    @media (max-width: 900px) {
        .mobile-buy-bar { padding-bottom: 22px; }
        .product-page { padding-bottom: 124px !important; }
    }
    @media (max-width: 560px) { .cg-cookie-consent { bottom: 22px; } }
}

/* Safari's toolbars: 100vh is taller than what is visible */
.lightbox-content { height: 100dvh; }
.lightbox-content img { max-height: 100dvh; }
.lightbox-content .lb-video-wrap { height: 100dvh; }
.media-modal-card { max-height: calc(100dvh - 40px); }
.media-modal-player { max-height: 82dvh; }
.media-modal-player.is-portrait { height: min(82dvh, calc(100dvh - 160px)); }
.lightbox img { max-height: 82dvh; }
@media (max-width: 900px) { .sidebar { min-height: 0; } }

/* gallery: the prev/next strips were 140px each = most of a phone screen, on top of the video controls */
@media (max-width: 600px) {
    .cg-lb-arrow { width: 52px !important; top: 30% !important; bottom: 30% !important; }
    .cg-lb-arrow::before { width: 34px; height: 72px; }
}

/* ══ Narrow phones (320–480) ══════════════════════════════════════════════════════════════════════ */
/* grid columns written as bare 1fr cannot shrink below their content: cards were cut on the right */
html .cart-grid { grid-template-columns: minmax(0, 1fr) 360px; }
@media (max-width: 1000px) { html .cart-grid { grid-template-columns: minmax(0, 1fr); } .cart-wrap { padding-top: 20px; } }
.promo-row input { min-width: 0; }
@media (max-width: 1100px) {
    html .tp { grid-template-columns: minmax(0, 1fr); }
    html .tp-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
}
@media (max-width: 400px) { .auth-box { min-width: 0; } }
@media (max-width: 768px) { .auth-box .form-row { grid-template-columns: minmax(0, 1fr) !important; } }

/* account top bar: the title was cut to "Мои к…", bell and avatar hidden at 320 */
@media (max-width: 480px) {
    .cg-acct .topbar { padding: 0 8px; }
    .cg-acct .topbar-left { gap: 4px; }
    .cg-acct .topbar-right { gap: 2px !important; }
    .cg-acct .page-title { font-size: 16px; }
    .cg-acct .topbar .store-lang-switcher { padding: 2px !important; gap: 2px !important; margin-right: 0; }
    .cg-acct .topbar .slang-btn { width: 26px !important; height: 24px !important; }
    .cg-acct .topbar-right > .badge { display: none; }
}

/* product page */
@media (max-width: 900px) { .prod-og { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
@media (max-width: 480px) { .prod-og { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 360px) { .related-grid { grid-template-columns: minmax(0, 1fr) !important; } }
.reviews-show-all { margin-bottom: 18px; }

/* order page: the key was broken three characters per line beside the copy button */
@media (max-width: 560px) {
    html .order-item { position: relative; }
    html .order-item-name, html .order-item-meta { padding-right: 96px; }
    html .order-item-price { position: absolute; top: 14px; right: 0; }
    html .order-key-box > div { flex-wrap: wrap; }
    html .order-key-value { flex: 1 1 100%; word-break: normal; overflow-wrap: anywhere; }
    html .order-key-box .copy-btn { margin-left: 0; }
}

/* my keys: the status at the end of the row was cut by the card edge */
html .key-card-status-row { flex-wrap: wrap; row-gap: 4px; }
html .key-card-status-row .key-instr-chip { white-space: nowrap; flex-shrink: 0; }
html .key-card-status-row > span { white-space: nowrap; }

/* purchases: summary cards stayed desktop-sized and stacked */
@media (max-width: 560px) {
    .cg-acct .content-body > div[style*="minmax(160px,260px)"] { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)) !important; gap: 8px !important; }
    .cg-acct .content-body > div[style*="minmax(160px,260px)"] > .card { padding: 14px 12px !important; }
    .cg-acct .content-body > div[style*="minmax(160px,260px)"] > .card > div:last-child { font-size: 1.15rem !important; white-space: nowrap; }
}
html .tx-table td:last-child { white-space: nowrap; }

/* affiliate */
@media (max-width: 640px) { .aff-table { font-size: .86rem; } .aff-table td { padding: 12px 10px; } }
@media (min-width: 641px) and (max-width: 820px) { html .aff-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 821px) and (max-width: 1100px) { html .aff-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 641px) and (max-width: 1100px) { html .aff-steps, html .aff-why { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.store-section-head > h1.store-section-title[style*="max-width"],
.store-section-head > p[style*="max-width"] { margin-left: auto !important; margin-right: auto !important; }
.store-section-head > div[style*="display:flex"] { justify-content: center; }

/* burger menu: the page heading showed through the open menu */
.snav-mobile-menu { background: #0d0f18; }

/* ══ Home ═════════════════════════════════════════════════════════════════════════════════════════ */
/* search results were clipped by the hero after the first result */
@media (max-width: 1023px) { #hero.store-hero { overflow: visible; overflow-x: clip; z-index: 5; } }
@media (max-width: 768px) { .cg-hsearch__drop { max-height: min(420px, 52vh); } }
/* stats bar: first and last item were cut at 881–1199 */
@media (min-width: 881px) and (max-width: 1199px) {
    .store-stats-inner { display: flex; flex-wrap: nowrap; justify-content: center; padding: 0 10px; }
    .store-stat-item { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px; text-align: center; padding: 14px 6px; justify-content: center; }
    .store-stat-num { font-size: 1.1rem; }
    .store-stat-label { font-size: .68rem; white-space: nowrap; }
    .store-stat-divider { display: none; }
}
/* feature cards: five crushed columns at ~1024, one orphan card on tablets */
@media (min-width: 1000px) and (max-width: 1279px) {
    .store-features-grid { grid-template-columns: repeat(6, 1fr); }
    .store-features-grid .store-feature { grid-column: span 2; }
    .store-features-grid .store-feature:nth-child(4) { grid-column: 2 / span 2; }
}
@media (min-width: 481px) and (max-width: 999px) {
    .store-features-grid { grid-template-columns: 1fr 1fr; }
    .store-features-grid .store-feature:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ══ Category (game) page ═════════════════════════════════════════════════════════════════════════ */
/* filter menus opened past the screen edge */
@media (max-width: 1023px) { .cat-chip:nth-child(n+3) .cat-chip__menu { left: auto; right: 0; } }
@media (max-width: 560px) {
    .cat-toolbar__chips { position: relative; }
    .cat-toolbar__chips .cat-chip { position: static; }
    .cat-toolbar__chips .cat-chip .cat-chip__menu { left: 0; right: auto; top: calc(100% + 6px); max-width: calc(100vw - 32px); }
    .cat-sec-head { flex-wrap: wrap; gap: 8px 12px; }
}
/* hero text lay on the bright cover picture */
@media (max-width: 820px) {
    .cat-hero__scrim {
        background: linear-gradient(to bottom, rgba(7,8,15,.66) 0%, rgba(7,8,15,.74) 55%, rgba(7,8,15,.86) 100%),
                    radial-gradient(ellipse 70% 60% at 30% 70%, rgba(124,58,237,.16), transparent 70%);
        -webkit-mask-image: none; mask-image: none;
    }
}
/* product rows: game name wrapped one word per line, badges stacked at 8px */
@media (max-width: 1100px) {
    .cat-grid--list .spc-meta { flex-wrap: wrap; row-gap: 6px; }
    .cat-grid--list .spc-category { white-space: nowrap; }
    .cat-grid--list .spc-inline-badges, .cat-grid--list .spc-inline-badges .cg-badges { flex-wrap: wrap; }
}
@media (max-width: 640px) {
    .cat-grid--list .spc-category { flex: 0 0 100%; white-space: normal; }
    .cat-grid--list .spc-meta .spc-status { white-space: nowrap; }
    .store-products-grid.cat-grid--list .spc-inline-badges .cg-badge { font-size: .62rem !important; padding: 4px 8px !important; }
}
@media (min-width: 881px) and (max-width: 1100px) {
    .cat-grid--list .store-product-card { grid-template-columns: 220px minmax(0, 1fr) 172px; }
    .cat-grid--list .spc-body { padding: 18px 18px; }
    .cat-grid--list .spc-footer { padding: 18px 16px; }
}
@media (min-width: 641px) and (max-width: 880px) {
    .cat-grid--list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}

/* ══ Product page, tablets and laptops ════════════════════════════════════════════════════════════ */
/* 2026-11-15, chosen in a buyer test: the chips are one row under the name, from the left edge, on every screen;
   order = status, rating, quality badges (then the staff-only instruction link). No more right-aligned stack,
   no rating on a line of its own, no name squeezed into a column. */
.phb { flex-wrap: wrap; row-gap: 14px; }
.phb-copy { flex: 1 1 100%; }
.phb-chips { flex: 1 1 100%; max-width: 100%; }
.phb-chip-row { justify-content: flex-start; gap: 6px; }
.phb-chip-row .cg-badges { display: contents !important; }
.phb-chip-row .spc-status { order: -2; }
.phb-chip-row .phb-rating { order: -1; }
@media (max-width: 600px) { .phb { row-gap: 10px; } }
/* 2026-11-15, owner: on a computer the chips sit on the right as before (status + badges in a row, the rating
   under them on the right). The game label never breaks. When name and chips do not fit in one line the chips
   take the next line, still on the right. Phones and the one-column layout (<=900px) keep the row under the name. */
@media (min-width: 901px) {
    .phb { flex-wrap: wrap; row-gap: 12px; }
    .phb-copy { flex: 1 1 220px; min-width: min-content; }
    .phb-game { white-space: nowrap; }
    .phb-chips { flex: 1 1 auto; max-width: 100%; }
    .phb-chip-row { justify-content: flex-end; }
    .phb-chip-row .spc-status { order: 0; }
    .phb-chip-row::after { content: ""; flex-basis: 100%; height: 0; order: 1; }
    .phb-chip-row .phb-instruction-preview { order: 2; }
    .phb-chip-row .phb-rating { order: 3; }
}
}
@media (max-width: 1280px) { .content-tab-btn { min-width: max-content; padding: 16px 14px; } }
/* first feature chip was cut off and unreachable when the strip is wider than its box */
.func-tabs-strip { justify-content: safe center; }
/* the price card is meant to follow the scroll; align-items:start left it no room to travel */
@media (min-width: 1101px) { .product-sidebar { align-self: stretch; } }

/* ══ Account ══════════════════════════════════════════════════════════════════════════════════════ */
@media (min-width: 901px) and (max-width: 1100px) {
    html .pf-pass form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    html .pf-pass form > .cgp-btn { justify-self: end; }
}
/* chat page was 12px taller than the screen */
.cg-acct .content-body:has(> .cg-chat-page) { padding-bottom: 16px; }
/* keyboard up: a long draft must not leave a slit of conversation */
.cg-chat .cg-chat-compose textarea.form-control { max-height: min(120px, calc(var(--cg-chat-height, 100dvh) * .28)); }

/* ══ Phone held sideways (low screens) ════════════════════════════════════════════════════════════ */
@media (orientation: landscape) and (max-height: 500px) {
    #hero.store-hero { min-height: 0; padding-top: 0; }
    #hero .store-hero-inner { padding-top: 22px; padding-bottom: 26px; }
    body.is-home .store-hero-title-big { font-size: clamp(2rem, 5vw, 2.6rem); }
    #hero .store-hero-title-big br { display: none; }
    section.store-section[style*="padding"]:first-of-type { padding-top: 28px !important; }
    .hw-media { max-width: calc((100vh - 90px) * 16 / 9); margin-inline: auto; }
    .cat-toolbar { position: static; }
    .cg-cookie-consent { bottom: 8px; width: calc(100% - 24px); }
    .cg-cookie-consent .cg-cookie-card { flex-direction: row; gap: 14px; padding: 10px 14px; text-align: left; }
    .cg-cookie-text { font-size: .8rem; line-height: 1.4; }
    .cg-cookie-btn { min-width: 0; padding: 10px 16px; }
    .cg-chat-head { padding: 6px 14px !important; }
    .cg-acct .content-body, .content-body { padding-top: 12px; padding-bottom: 12px; }
}
