/*
 * Dorss Market: мини-приложение Telegram. Оформление: вариант B (hero-карта, билет со штрихкодом, нижнее меню).
 * Тема своя, светлая или тёмная: app.js ставит <html data-theme="light|dark"> по Telegram.WebApp.colorScheme и следит за themeChanged;
 * до этого момента работает тема системы. Переменные темы Telegram (tg-theme) не используются: приглушённый текст Telegram не проходит контраст 4.5:1.
 * Акцент бренда #f2640e только заливкой (тёмный текст на нём 4.99:1), оранжевый текст только тёмным оттенком.
 * Штрихкод всегда чёрный на белом (касса сканирует контраст), зоны нажатия не меньше 44 px.
 * Шрифты свои (assets/fonts, лицензия SIL OFL): Oswald (заголовки, кнопки), Bebas Neue (цифры баланса), Source Sans 3 (текст).
 */

/* ---------- Шрифты: подмножества latin и cyrillic и отдельный знак ₽ (U+20BD), файлы переменные ---------- */
@font-face {
    font-family: "Oswald";
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url("fonts/oswald-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: "Oswald";
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url("fonts/oswald-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Oswald";
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url("fonts/oswald-ruble.woff2") format("woff2");
    unicode-range: U+20BD;
}
@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("fonts/source-sans-3-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("fonts/source-sans-3-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("fonts/source-sans-3-ruble.woff2") format("woff2");
    unicode-range: U+20BD;
}
@font-face {
    font-family: "Bebas Neue";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("fonts/bebas-neue-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Токены ---------- */
:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #1c232b;
    --muted: #566270;
    --line: #e6e9ed;

    --accent: #f2640e;
    --accent-hover: #ff7a2e;
    --accent-ink: #1c232b;
    --accent-text: #b03d04;
    --accent-soft: #fff1e8;

    --hero-a: #1c232b;
    --hero-b: #262f38;
    --hero-line: transparent;
    --hero-orange: #ff7a2e;
    --hero-orange-text: #ffa066;
    --hero-muted: #aab6c2;
    --tile: #ffffff;

    --ticket: #ffffff;
    --ticket-ink: #1c232b;
    --ticket-muted: #4a5662;

    --shadow: 0 1px 2px rgba(28, 35, 43, 0.06), 0 8px 24px rgba(28, 35, 43, 0.08);
    --focus: #1c232b;

    --font-display: "Oswald", "Arial Narrow", "Roboto Condensed", sans-serif-condensed, sans-serif;
    --font-num: "Bebas Neue", "Oswald", "Arial Narrow", sans-serif-condensed, sans-serif;
    --font-body: "Source Sans 3", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;

    --tabbar-h: 64px;
}

/* Тёмные значения записаны дважды: для темы системы до запуска app.js и для явного data-theme="dark". */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        color-scheme: dark;
        --bg: #0f1419;
        --surface: #1a2128;
        --text: #eef1f4;
        --muted: #9aa7b4;
        --line: #2a333c;
        --accent-text: #ff8a4a;
        --accent-soft: #2b1d14;
        --hero-a: #2a343e;
        --hero-b: #1c232b;
        --hero-line: #3a4651;
        --tile: #e9edf1;
        --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 28px rgba(0, 0, 0, 0.35);
        --focus: #ffffff;
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f1419;
    --surface: #1a2128;
    --text: #eef1f4;
    --muted: #9aa7b4;
    --line: #2a333c;
    --accent-text: #ff8a4a;
    --accent-soft: #2b1d14;
    --hero-a: #2a343e;
    --hero-b: #1c232b;
    --hero-line: #3a4651;
    --tile: #e9edf1;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 28px rgba(0, 0, 0, 0.35);
    --focus: #ffffff;
}

/* ---------- Основа ---------- */
*, *::before, *::after {
    box-sizing: border-box;
}
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 16px/1.4 var(--font-body);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    overflow-x: hidden;
}
h1, h2, p, ul {
    margin: 0;
    padding: 0;
}
ul {
    list-style: none;
}
img, svg {
    display: block;
    max-width: 100%;
}
button {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
[hidden] {
    display: none !important;
}
:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
    border-radius: 12px;
}
.hero :focus-visible {
    outline-color: #ffffff; /* на тёмной карте тёмное кольцо фокуса не видно */
}

.app {
    width: 100%;
    max-width: 430px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 12px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 24px);
}
/* Текст только для чтения с экрана */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}
body > .screen {
    max-width: 430px;
    margin: 0 auto;
    padding: 12px 16px;
}
.notice {
    margin: 24px 0;
    text-align: center;
    color: var(--muted);
}
body.is-closed .tabbar,
body.is-closed .cta {
    display: none;
}
body.is-closed .app {
    padding-bottom: 24px;
}

/* ---------- Кнопки ---------- */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 56px;
    padding: 0 20px;
    border-radius: 16px;
    font: 600 17px/1 var(--font-display);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: center;
    transition: background-color 0.18s ease, transform 0.12s ease, border-color 0.18s ease;
}
.btn svg {
    flex: none;
    width: 22px;
    height: 22px;
}
.btn:active {
    transform: scale(0.98);
}
.btn--primary {
    background: var(--accent);
    color: var(--accent-ink);
}
.btn--primary:hover {
    background: var(--accent-hover);
}
.btn--primary:active {
    background: var(--accent);
}
/* Неактивные: главная кнопка остаётся в полном цвете (подпись «Оформляем карту...» должна читаться), «Назад» бледнеет */
.btn:disabled,
.linkbtn:disabled {
    cursor: default;
}
.btn:disabled:active,
.linkbtn:disabled:active {
    transform: none;
}
.btn--primary:disabled:hover {
    background: var(--accent);
}
.linkbtn:disabled {
    opacity: 0.6;
}
.btn--outline {
    border: 2px solid var(--text);
    color: var(--text);
}
.btn--outline:hover {
    background: var(--surface);
}
.cta {
    margin-top: 12px;
}

/* ---------- Баннеры главной страницы сайта под кнопкой «Сайт и личный кабинет» ---------- */
.banners {
    margin-top: 16px;
}
.banners[hidden] {
    display: none;
}
.banners__track {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-radius: 20px;
}
.banners__track::-webkit-scrollbar {
    display: none;
}
.banner {
    display: block;
    flex: 0 0 100%;
    scroll-snap-align: start;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 20px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow);
    font: inherit;
    color: inherit;
}
button.banner {
    cursor: pointer;
}
button.banner:active {
    transform: scale(0.99);
}
button.banner:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}
.banner__img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1776 / 600;   /* размер баннеров главной сайта; высота задаётся картинкой, а не кнопкой */
    object-fit: cover;
}
.banners__dots {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-top: 6px;
}
.banners__dot {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    position: relative;
    cursor: pointer;
}
.banners__dot::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--line);
    transition: background-color 0.2s, transform 0.2s;
}
.banners__dot.is-active::before {
    background: var(--accent);
    transform: scale(1.25);
}
.banners__dot:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: -2px;
    border-radius: 50%;
}
.more {
    margin-top: 16px;
}

/* ---------- Герой-карта ---------- */
.hero {
    overflow: hidden;
    border: 1px solid var(--hero-line);
    border-radius: 28px;
    background: linear-gradient(160deg, var(--hero-a), var(--hero-b));
    background-clip: padding-box;
    color: #ffffff;
    box-shadow: var(--shadow);
    animation: rise 0.4s ease-out backwards;
}
/* Тот же экран перерисован (busy, ошибка под полем): вход не проигрываем заново, иначе карта гаснет и проявляется (класс ставит mount в app.js) */
.screen--still .hero,
.screen--still .facts {
    animation: none;
}
.hero__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 0;
}
.hero__tag {
    min-width: 0;
    font: 500 13px/1 var(--font-display);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: right;
    overflow-wrap: anywhere;
    color: var(--hero-muted);
}
.hero__logo {
    display: block;
    flex: none;
    width: 112px;
    height: 30px;
    background: url("dorss-logo.png") left center / contain no-repeat;
}
.hero__body {
    padding: 22px 20px 26px;
}
.hero__label {
    font: 600 14px/1 var(--font-body);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hero-muted);
}
.balance {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 10px;
    margin-top: 8px;
}
.balance__num {
    font: 400 88px/0.86 var(--font-num);
    letter-spacing: 0.01em;
    color: var(--hero-orange);
    font-variant-numeric: tabular-nums;
}
.balance__num--s {
    font-size: 64px;
}
.balance__num--xs {
    font-size: 48px;
}
.balance__unit {
    font: 500 22px/1 var(--font-display);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.rate {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    margin-top: 16px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font: 600 15px/1 var(--font-body);
}
.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 0 12px 0 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font: 600 14px/1 var(--font-body);
}
.status svg {
    width: 18px;
    height: 18px;
    color: #4ade80;
}
.hero__icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-top: 18px;
}
.hero__icon svg {
    grid-area: 1 / 1;
}
.hero__icon .hex {
    width: 64px;
    height: 64px;
    fill: var(--accent);
    stroke: var(--accent);
}
.hero__icon .glyph {
    width: 28px;
    height: 28px;
    color: var(--accent-ink);
}
.hero__title {
    font: 600 32px/1.08 var(--font-display);
    letter-spacing: 0.01em;
    text-transform: uppercase;
    text-wrap: balance;
    overflow-wrap: break-word;
}
.hero__icon + .hero__title {
    margin-top: 14px;
}
.hero__text {
    margin-top: 12px;
    font: 400 17px/1.45 var(--font-body);
    color: #d3dbe3;
    text-wrap: pretty;
}
/* Согласие на обработку номера: мелко, под пояснением, ссылка на политику - строчная кнопка */
/* Подвал «Продавец»: сведения о продавце под экраном, над нижним меню; мелко и спокойно, ссылки - строчные кнопки */
.seller {
    margin-top: 16px;
}
.seller__card {
    padding: 16px 18px 18px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
    font: 400 14px/1.5 var(--font-body);
    color: var(--muted);
}
.seller__label {
    margin: 0 0 6px;
    font: 500 12px/1 var(--font-display);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-text);
}
.seller__line {
    margin: 0 0 4px;
    overflow-wrap: anywhere;
}
.seller__name {
    margin: 0;
    font: 600 17px/1.3 var(--font-body);
    color: var(--text);
}
.seller__meta {
    margin: 3px 0 0;
    font-size: 13px;
    text-wrap: pretty;
}
.seller__rows {
    list-style: none;
    margin: 12px 0 0;
    padding: 12px 0 0;
    border-top: 1px solid var(--line);
}
.seller__row,
.seller__note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 8px;
    overflow-wrap: anywhere;
}
.seller__row {
    color: var(--text);
}
.seller__note {
    margin: 2px 0 0;
    font-size: 13px;
}
.seller__row svg,
.seller__note svg {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    color: var(--accent-text);
}
.seller__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 0;
}
.seller__link {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg);
    font: 600 13px/1 var(--font-body);
    color: var(--text);
    cursor: pointer;
}
.seller__link:active {
    transform: scale(0.98);
}
.seller__link:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}
.hero__consent {
    margin-top: 12px;
    font: 400 14px/1.6 var(--font-body);
    color: var(--hero-muted);
    text-wrap: pretty;
}
.hero__link {
    display: inline;
    padding: 5px 0;
    border: 0;
    background: none;
    font: inherit;
    color: var(--hero-orange-text);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

/* Оформление карты: поле имени и строка номера на тёмной карте */
.field {
    margin-top: 20px;
}
.field__label {
    display: block;
    font: 500 14px/1.2 var(--font-display);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hero-muted);
}
.field__input {
    display: block;
    width: 100%;
    min-height: 52px;
    margin: 8px 0 0;
    padding: 0 16px;
    border: 2px solid var(--hero-muted);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font: 400 18px/1.2 var(--font-body);
    appearance: none;
}
.field__input[aria-invalid="true"] {
    border-color: var(--hero-orange-text);
}
.field__input:disabled {
    opacity: 0.6;
}
.field__error {
    margin-top: 8px;
    font: 400 14px/1.4 var(--font-body);
    color: var(--hero-orange-text);
}
.hero__phone {
    margin-top: 14px;
    font: 400 16px/1.3 var(--font-body);
    color: #d3dbe3;
}

/* Билет: белая нижняя часть карты со штрихкодом (всегда чёрное на белом) */
.ticket {
    position: relative;
    padding: 20px 20px 16px;
    background: var(--ticket);
    color: var(--ticket-ink);
}
.ticket::before,
.ticket::after {
    content: "";
    position: absolute;
    top: -13px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg);
}
.ticket::before {
    left: -13px;
}
.ticket::after {
    right: -13px;
}
.barcode {
    display: block;
    max-width: 100%;
    height: 84px;
    margin: 0 auto;
}
.barcode-missing {
    margin: 8px 0;
    color: var(--ticket-muted);
    text-align: center;
}
.ticket__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 24px;
    margin-top: 12px;
}
.ticket__label {
    font: 600 14px/1.2 var(--font-body);
    color: var(--ticket-muted);
}
.ticket__mask {
    font: 600 19px/1 var(--font-display);
    letter-spacing: 0.1em;
    color: var(--ticket-ink);
}

/* Ряд действий на тёмной карте: кнопка или две плитки */
.ticket--actions {
    display: grid;
    gap: 10px;
    padding: 0 20px 20px;
    background: transparent;
    color: inherit;
}
.ticket--actions::before,
.ticket--actions::after {
    display: none;
}
.ticket--tiles {
    grid-template-columns: 1fr 1fr;
}
.tile {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 10px;
    border: 2px solid #ffffff;
    border-radius: 16px;
    color: #ffffff;
    font: 600 16px/1 var(--font-display);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
}
.tile svg {
    flex: none;
    width: 20px;
    height: 20px;
}
.tile:hover {
    background: #ffffff;
    color: var(--hero-a);
}
.tile:active {
    transform: scale(0.98);
}

/* ---------- Выбор карты, когда у номера несколько карт ---------- */
.cardlist {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}
.cardpick {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 12px;
    width: 100%;
    min-height: 60px;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
    text-align: left;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}
.cardpick:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.1);
}
.cardpick:active {
    transform: scale(0.98);
}
.cardpick__main {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1 1 auto;
    min-width: 0;
}
.cardpick__type {
    font: 600 18px/1.15 var(--font-display);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}
.cardpick__mask {
    font: 600 14px/1 var(--font-display);
    letter-spacing: 0.1em;
    color: var(--hero-muted);
}
/* «N бонусов» мелким кеглем: --hero-orange-text светлее --hero-orange, иначе на плашке (белая заливка до .10 при наведении) контраст ниже 4.5:1.
   Строка переносится целиком (flex-wrap у .cardpick): сумма уходит под вид карты вправо, слова вида не рвутся. */
.cardpick__bonus {
    flex: none;
    margin-left: auto;
    font: 500 18px/1.1 var(--font-display);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-align: right;
    color: var(--hero-orange-text);
}
.cardlist__total {
    margin-top: 14px;
    font: 400 14px/1.3 var(--font-body);
    color: var(--hero-muted);
}
.linkbtn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    margin-top: 8px;
    padding: 0 16px;
    border-radius: 16px;
    color: var(--accent-text);
    font: 600 16px/1 var(--font-display);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: background-color 0.18s ease, transform 0.12s ease;
}
.linkbtn svg {
    flex: none;
    width: 20px;
    height: 20px;
}
.linkbtn:hover {
    background: var(--surface);
}
.linkbtn:active {
    transform: scale(0.98);
}

/* ---------- Факты под картой ---------- */
.facts {
    margin-top: 12px;
    padding: 4px 0;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    animation: rise 0.4s ease-out 0.08s backwards;
}
.facts li {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 56px;
    padding: 8px 16px;
    font-size: 16px;
}
.facts li + li {
    border-top: 1px solid var(--line);
}
.facts__ico {
    display: grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent-text);
}
.facts__ico svg {
    width: 20px;
    height: 20px;
}
.facts b {
    font-weight: 700;
}

/* ---------- Заголовок вкладки списка ---------- */
.sect-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0 16px;
}
.sect-head h1 {
    font: 700 40px/1 var(--font-display);
    letter-spacing: 0.01em;
    text-transform: uppercase;
}
.sect-head p {
    margin-top: 6px;
    font: 400 15px/1.3 var(--font-body);
    color: var(--muted);
}
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 16px;
    border: 2px solid var(--text);
    border-radius: 999px;
    font: 600 14px/1 var(--font-display);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: background-color 0.18s ease, transform 0.12s ease;
}
.pill svg {
    width: 16px;
    height: 16px;
}
.pill:hover {
    background: var(--surface);
}
.pill:active {
    transform: scale(0.97);
}

/* ---------- Товары ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.pcard {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 8px 8px 14px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    color: inherit;
    text-align: left;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.pcard:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: var(--shadow);
}
.pcard:active {
    transform: scale(0.985);
}
.pcard__img {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 14px;
    background: var(--tile);
}
.pcard__img img {
    width: 100%;
    height: 100%;
    padding: 8px;
    object-fit: contain;
    mix-blend-mode: multiply;
}
.pcard__noimg {
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    transform: translateY(-50%);
    color: #566270;
    font-size: 13px;
    text-align: center;
}
.badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 8px;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-ink);
    font: 600 15px/1 var(--font-display);
    letter-spacing: 0.02em;
}
.pcard__name {
    display: -webkit-box;
    margin: 10px 4px 0;
    overflow: hidden;
    font: 600 14px/1.28 var(--font-body);
    overflow-wrap: break-word;
    hyphens: manual;
    -webkit-line-clamp: 5;
    line-clamp: 5;
    -webkit-box-orient: vertical;
}
.nb {
    white-space: nowrap;
}
.price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 8px;
    margin: auto 4px 0;
    padding-top: 10px;
}
.price__now {
    font: 600 21px/1.15 var(--font-display);
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.price__old {
    font: 400 14px/1.15 var(--font-body);
    color: var(--muted);
    text-decoration: line-through;
    white-space: nowrap;
}
.pcard--oos .pcard__img img {
    opacity: 0.35;
    filter: grayscale(1);
}
.pcard--oos .price__now {
    color: var(--muted);
}
.oos {
    position: absolute;
    inset: auto 8px 8px 8px;
    z-index: 1;
    display: grid;
    place-items: center;
    min-height: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: 600 13px/1 var(--font-body);
    text-align: center;
}

/* ---------- Нижнее меню ---------- */
.tabbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    max-width: 430px;
    padding: 0 8px env(safe-area-inset-bottom, 0px);
    transform: translateX(-50%);
    border-top: 1px solid var(--line);
    background: var(--surface);
}
.tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: var(--tabbar-h);
    color: var(--muted);
    font: 600 13px/1 var(--font-body);
    letter-spacing: 0.02em;
    transition: color 0.18s ease;
}
.tab svg {
    width: 24px;
    height: 24px;
    transition: transform 0.18s ease;
}
.tab::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 36px;
    height: 3px;
    margin-left: -18px;
    border-radius: 0 0 3px 3px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform 0.2s ease;
}
.tab.is-active {
    color: var(--text);
    font-weight: 700;
}
.tab.is-active svg {
    color: var(--accent-text);
    transform: translateY(-1px);
}
.tab.is-active::before {
    transform: scaleX(1);
}
.tab:hover {
    color: var(--text);
}
.tab:focus-visible {
    outline-offset: -4px;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 359px) {
    .app {
        padding-right: 12px;
        padding-left: 12px;
    }
    .balance__num {
        font-size: 76px;
    }
    .balance__num--s {
        font-size: 56px;
    }
    .balance__num--xs {
        font-size: 42px;
    }
    .hero__title {
        font-size: 28px;
    }
    .grid {
        gap: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
    .btn:active, .tile:active, .pill:active, .pcard:active, .pcard:hover, .cardpick:active, .linkbtn:active {
        transform: none;
    }
}
