/* Быстрая покупка на мобильной главной (под баннером) — раскладка как у Playerok,
   цвета и скругления сайта. Работает в светлой и тёмной теме через токены --pn-*. */
.pn-qb { display: none; }

@media all { /* phones and, since V2.7.22, computers */
    .pn-qb { display: block; position: relative; margin-top: 16px; color: var(--pn-ink); }
    /* :where — нулевая специфичность: снимает глобальные 44px с кнопок, но не перебивает классы блока. */
    .pn-qb :where(button) { min-width: 0; min-height: 0; font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
    .pn-qb-panel:empty { min-height: 360px; } /* место под панель до запуска скрипта — без скачка страницы */
    .pn-qb svg { transition: none !important; transform: none !important; }

    /* Вкладки-иконки */
    .pn-qb-tabs {
        display: flex; gap: 4px; padding: 4px;
        border: 1px solid var(--pn-line); border-radius: 999px; background: var(--pn-white);
    }
    .pn-qb-tab {
        flex: 1 1 0; height: 44px; display: flex; align-items: center; justify-content: center;
        border: 0; border-radius: 999px; background: transparent; cursor: pointer;
    }
    .pn-qb-tab img { width: 30px; height: 30px; border-radius: 9px; object-fit: cover; opacity: .62; }
    .pn-qb-tab.is-active { background: var(--pn-paper); box-shadow: 0 1px 3px #20211e1f; }
    .pn-qb-tab.is-active img { opacity: 1; }

    /* Шапка товара */
    .pn-qb-head { display: flex; align-items: center; gap: 13px; margin: 18px 0 14px; }
    .pn-qb-thumb { flex: none; width: 96px; height: 72px; border-radius: 12px; object-fit: contain; padding: 4px; box-sizing: border-box; background: var(--pn-line); }
    .pn-qb-head-text { min-width: 0; flex: 1 1 auto; }
    .pn-qb-title { margin: 0 0 7px; font-size: 20px; font-weight: 700; line-height: 1.15; letter-spacing: -.025em; }
    .pn-qb-badges { display: flex; flex-wrap: wrap; gap: 6px; }
    .pn-qb-badge { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 7px; font-size: 12px; font-weight: 650; white-space: nowrap; }
    .pn-qb-badge svg { width: 13px; height: 13px; }
    .pn-qb-badge.is-auto { background: #eef4da; color: var(--pn-green); }
    .pn-qb-badge.is-manual { background: #fff3dc; color: #8a5a12; }
    .pn-qb-badge.is-brand { background: #ebece6; color: var(--pn-ink); }
    .pn-qb-cur { flex: none; display: flex; gap: 7px; align-self: flex-end; }
    .pn-qb-cur button {
        width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
        border: 1px solid var(--pn-line); border-radius: 50%; background: var(--pn-white); font-size: 15px; font-weight: 700; cursor: pointer;
    }
    .pn-qb-cur button[aria-pressed="true"] { border-color: var(--pn-ink); background: var(--pn-ink); color: var(--pn-paper); }

    /* Поля */
    .pn-qb-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
    .pn-qb-full { grid-column: 1 / -1; }
    .pn-qb-field {
        position: relative; display: block; width: 100%; height: 60px; margin: 0; padding: 0 14px;
        border: 1.5px solid var(--pn-line); border-radius: 14px; background: var(--pn-white);
        text-align: left; cursor: text; transition: border-color .15s, box-shadow .15s;
    }
    .pn-qb-field:focus-within, .pn-qb-field.is-open { border-color: var(--pn-green); box-shadow: 0 0 0 1px var(--pn-green); }
    .pn-qb-label {
        position: absolute; left: 14px; right: 14px; top: 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
        color: var(--pn-muted); font-size: 13px; line-height: 1.2; pointer-events: none; transition: top .15s, font-size .15s, transform .15s;
    }
    .pn-qb-field.is-empty:not(:focus-within) .pn-qb-label { top: 50%; transform: translateY(-50%); font-size: 16px; }
    .pn-qb-control { position: absolute; left: 14px; right: 14px; bottom: 9px; display: flex; align-items: baseline; gap: 4px; min-width: 0; }
    .pn-qb-field.is-empty:not(:focus-within) .pn-qb-control { opacity: 0; }
    .pn-store .pn-qb .pn-qb-field input {
        min-width: 0; width: 100%; height: 24px; margin: 0; padding: 0; border: 0 !important; outline: 0 !important; box-shadow: none !important;
        background: transparent; color: var(--pn-ink); font-size: 17px !important; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em;
    }
    .pn-qb-field input.is-sized { width: auto; flex: none; }
    /* One-line textarea (account fields): looks exactly like the inputs above. */
    .pn-store .pn-qb .pn-qb-field textarea.pn-qb-plain {
        display: block; min-width: 0; width: 100%; height: 24px; margin: 0; padding: 0; border: 0 !important; outline: 0 !important; box-shadow: none !important;
        background: transparent; color: var(--pn-ink); font: inherit; font-size: 17px !important; font-weight: 650; line-height: 24px; letter-spacing: -.01em;
        resize: none; overflow: hidden; white-space: pre; scrollbar-width: none;
    }
    .pn-qb-suffix { flex: none; color: var(--pn-ink); font-size: 17px; font-weight: 650; }
    .pn-qb-suffix img { width: 18px; height: 18px; vertical-align: -3px; }
    .pn-qb-field.has-info .pn-qb-label, .pn-qb-field.has-info .pn-qb-control { right: 46px; }
    .pn-qb-info {
        position: absolute; right: 12px; top: 50%; transform: translateY(-50%) !important; width: 26px; height: 26px; border: 0; border-radius: 50%;
        background: var(--pn-line); color: var(--pn-muted); font-size: 14px; font-weight: 800; line-height: 26px; text-align: center; cursor: pointer;
    }
    /* Поле-список */
    .pn-qb-select { cursor: pointer; }
    .pn-qb-select .pn-qb-label { right: 40px; }
    .pn-qb-select .pn-qb-value { position: absolute; left: 14px; right: 40px; bottom: 9px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 17px; font-weight: 650; }
    .pn-qb-chevron { position: absolute; right: 13px; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: var(--pn-muted); transition: transform .15s !important; }
    .pn-qb-select.is-open .pn-qb-chevron { transform: rotate(180deg) !important; }
    .pn-qb-list {
        position: absolute; z-index: 30; max-height: 312px; overflow-y: auto; overscroll-behavior: contain; padding: 6px 0;
        border: 1px solid var(--pn-line); border-radius: 14px; background: var(--pn-white); box-shadow: 0 18px 50px #20211e2e;
    }
    .pn-qb-opt {
        display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 48px; padding: 8px 16px;
        border: 0; background: none; text-align: left; font-size: 16px; font-weight: 650; cursor: pointer;
    }
    .pn-qb-opt:hover, .pn-qb-opt:focus-visible { background: var(--pn-paper); }
    .pn-qb-opt[aria-selected="true"] { color: var(--pn-green); }
    .pn-qb-opt svg { flex: none; width: 20px; height: 20px; }

    /* Строки под полями */
    .pn-qb-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 26px; margin: 12px 2px 0; color: var(--pn-muted); font-size: 14px; }
    .pn-qb-row:empty { display: none; }
    .pn-qb-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--pn-lime); color: #20211e; font-weight: 750; font-size: 13px; }
    .pn-qb-row > span { min-width: 0; }
    .pn-qb-link { flex: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 2px; margin-left: auto; padding: 4px 0; border: 0; background: none; color: var(--pn-green); font-size: 14px; font-weight: 650; cursor: pointer; }
    .pn-qb-link svg { width: 16px; height: 16px; }
    .pn-qb-promo { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 10px; }
    .pn-qb-promo .pn-qb-field { height: 52px; }
    .pn-qb-promo .pn-qb-label { top: 8px; }
    .pn-qb-promo .pn-qb-control { bottom: 7px; }
    .pn-qb-apply { padding: 0 16px; border: 0; border-radius: 14px; background: var(--pn-ink); color: var(--pn-paper) !important; font-size: 14px; font-weight: 650; cursor: pointer; }
    .pn-qb-status { margin: 9px 2px 0; color: var(--pn-muted); font-size: 13px; line-height: 1.4; }
    .pn-qb-status:empty { display: none; }
    .pn-qb-status.is-ok { color: var(--pn-green); }
    .pn-qb-status.is-error { color: #a8443a; }
    .pn-qb-status button { margin-left: 6px; padding: 0; border: 0; background: none; color: var(--pn-green); font-weight: 700; text-decoration: underline; cursor: pointer; }

    /* Кнопка оплаты */
    .pn-qb-paywrap { margin-top: 14px; }
    .pn-qb-pay {
        display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; border: 0; border-radius: 14px;
        background: var(--pn-lime); color: #20211e !important; box-shadow: inset 0 -3px 0 #20211e1f;
        font-size: 16px; font-weight: 750; letter-spacing: -.01em; cursor: pointer; transition: transform .1s, background .15s;
    }
    .pn-qb-pay:active:not(:disabled) { transform: translateY(1px); }
    .pn-qb-pay:disabled { background: var(--pn-line); color: var(--pn-muted) !important; box-shadow: none; cursor: default; }
    .pn-qb-pay.is-busy { opacity: .7; }
    .pn-qb-hint { margin: 8px 2px 0; color: var(--pn-muted); font-size: 12px; text-align: center; }
    .pn-qb-hint:empty { display: none; }
    .pn-qb-hint.is-error { color: #a8443a; }
}

/* Окно выбора способа оплаты (открывается по «Оплатить») */
html.pn-qb-locked, html.pn-qb-locked body { overflow: hidden; }
.pn-qb-sheet-backdrop {
    position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center;
    background: rgba(20, 22, 18, 0); transition: background .2s;
}
.pn-qb-sheet-backdrop.is-open { background: rgba(20, 22, 18, .48); }
.pn-qb-sheet {
    width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
    padding: 8px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    border-radius: 22px 22px 0 0; background: var(--pn-paper); color: var(--pn-ink);
    box-shadow: 0 -12px 40px #20211e33; transform: translateY(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
.pn-qb-sheet-backdrop.is-open .pn-qb-sheet { transform: none; }
.pn-qb-sheet-grab { display: block; width: 40px; height: 4px; margin: 2px auto 10px; border-radius: 4px; background: var(--pn-line); }
.pn-qb-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pn-qb-sheet-head h3 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.pn-store .pn-qb-sheet-close {
    width: 36px; height: 36px; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center;
    border: 0; border-radius: 50%; background: var(--pn-white); color: var(--pn-muted); font-size: 24px; line-height: 1; cursor: pointer;
}
.pn-qb-sheet-sub { margin: 6px 0 14px; color: var(--pn-muted); font-size: 14px; }
.pn-qb-methods { display: grid; gap: 8px; }
.pn-store .pn-qb-method {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 64px; margin: 0; padding: 10px 16px;
    border: 1.5px solid var(--pn-line); border-radius: 14px; background: var(--pn-white); color: var(--pn-ink);
    font: inherit; text-align: left; cursor: pointer; transition: border-color .15s;
}
.pn-store .pn-qb-method:not(:disabled):active, .pn-store .pn-qb-method.is-busy { border-color: var(--pn-green); }
.pn-store .pn-qb-method:disabled { cursor: default; }
.pn-store .pn-qb-method:disabled:not(.is-busy) .pn-qb-method-text { opacity: .55; }
.pn-qb-method-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pn-store .pn-qb-method .pn-qb-method-text { flex: 1 1 auto; }
.pn-qb-method-logo { flex: none; width: 30px; height: 30px; object-fit: contain; border-radius: 7px; }
.pn-qb-method-logo.is-wide { width: 44px; }
.pn-qb-method-group { margin: 6px 2px 0; color: var(--pn-muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.pn-qb-method-group:first-child { margin-top: 0; }
html[data-theme="dark"] .pn-qb-method-logo { background: #fff; padding: 2px; }
.pn-qb-method-name { font-size: 17px; font-weight: 700; }
.pn-qb-method-note { color: var(--pn-muted); font-size: 12px; }
.pn-qb-method-price { flex: none; font-size: 16px; font-weight: 750; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pn-qb-sheet-error { margin: 10px 2px 0; color: #a8443a; font-size: 13px; }
.pn-qb-sheet-error:empty { display: none; }
html[data-theme="dark"] .pn-qb-sheet-backdrop.is-open { background: rgba(0, 0, 0, .6); }
html[data-theme="dark"] .pn-qb-sheet { box-shadow: 0 -12px 40px #00000099; }
html[data-theme="dark"] .pn-store .pn-qb-sheet-close { background: var(--night-raised, #272e22); }
html[data-theme="dark"] .pn-store .pn-qb-method:not(:disabled):active, html[data-theme="dark"] .pn-store .pn-qb-method.is-busy { border-color: var(--pn-lime); }
html[data-theme="dark"] .pn-qb-sheet-error { color: var(--night-danger, #ffa897); }

/* Тёмная тема */
@media all { /* phones and, since V2.7.22, computers */
    html[data-theme="dark"] .pn-qb-tab.is-active { background: var(--night-hover, #303a28); box-shadow: none; }
    html[data-theme="dark"] .pn-qb-badge.is-auto { background: #2a3820; color: var(--pn-lime); }
    html[data-theme="dark"] .pn-qb-badge.is-manual { background: #3a3020; color: #f3c46d; }
    html[data-theme="dark"] .pn-qb-badge.is-brand { background: var(--night-raised, #272e22); color: var(--pn-ink); }
    html[data-theme="dark"] .pn-qb-cur button[aria-pressed="true"] { border-color: var(--pn-lime); background: var(--pn-lime); color: var(--night-on-lime, #202719); }
    html[data-theme="dark"] .pn-qb-field:focus-within, html[data-theme="dark"] .pn-qb-field.is-open { border-color: var(--pn-lime); box-shadow: 0 0 0 1px var(--pn-lime); }
    html[data-theme="dark"] .pn-qb-opt[aria-selected="true"], html[data-theme="dark"] .pn-qb-link,
    html[data-theme="dark"] .pn-qb-status.is-ok, html[data-theme="dark"] .pn-qb-status button { color: var(--pn-lime); }
    html[data-theme="dark"] .pn-qb-opt:hover, html[data-theme="dark"] .pn-qb-opt:focus-visible { background: var(--night-raised, #272e22); }
    html[data-theme="dark"] .pn-qb-list { box-shadow: 0 18px 50px #0000008c; }
    html[data-theme="dark"] .pn-qb-apply { background: var(--pn-lime); color: var(--night-on-lime, #202719) !important; }
    html[data-theme="dark"] .pn-qb-pay { color: var(--night-on-lime, #202719) !important; }
    html[data-theme="dark"] .pn-qb-pay:disabled { background: var(--night-raised, #272e22); color: var(--night-dim, #929d86) !important; }
    html[data-theme="dark"] .pn-qb-info { background: var(--night-raised, #272e22); }
    html[data-theme="dark"] .pn-qb-status.is-error, html[data-theme="dark"] .pn-qb-hint.is-error { color: var(--night-danger, #ffa897); }
}

/* Computers: the payment choice opens as a centred dialog, not a bottom sheet */
@media (min-width: 768px) {
    .pn-qb-sheet-backdrop { align-items: center; padding: 24px; }
    .pn-qb-sheet { max-width: 520px; max-height: 86vh; border-radius: 22px; padding: 12px 20px 20px; transform: translateY(16px); opacity: 0; transition: transform .2s, opacity .2s; }
    .pn-qb-sheet-backdrop.is-open .pn-qb-sheet { transform: none; opacity: 1; }
    .pn-qb-sheet-grab { display: none; }
}
