/* Витрина подарков. Токены те же, что в v2.css: страница выглядит частью сайта и без него.
   Карточка подарка (.mk-sheet) лежит вне страницы, поэтому токены объявлены и на ней. */

.mk, .mk-sheet, .rw-modal {
    --mk-bg: #0A0A0A; --mk-surface: #111111; --mk-surface-2: #161616; --mk-surface-3: #1D1D1D;
    --mk-line: rgba(255, 255, 255, 0.07); --mk-line-strong: rgba(255, 255, 255, 0.14);
    --mk-text: #F5F5F5; --mk-muted: #9A9A9A; --mk-dim: #8A8A8A;   /* 26.09: #707070 давал контраст 4:1 при норме 4,5 */
    --mk-red: #E50914; --mk-red-soft: rgba(229, 9, 20, 0.10); --mk-red-line: rgba(229, 9, 20, 0.6);
    --mk-ease: cubic-bezier(0.22, 0.8, 0.26, 1);
    font-family: "Onest", -apple-system, "Segoe UI", Roboto, sans-serif;
}
/* Футер не всплывает к середине экрана, когда подарков мало. */
.mk { min-height: calc(100vh - 300px); padding-bottom: 56px; }
.mk [hidden] { display: none !important; }
.mk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
body.mk-lock { overflow: hidden; }

/* Автозаполнение браузера красило поля в голубой. Поля остаются в цветах сайта. */
.mk input:-webkit-autofill, .mk input:-webkit-autofill:hover, .mk input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--mk-text);
    -webkit-box-shadow: 0 0 0 1000px var(--mk-surface) inset;
    transition: background-color 9999s ease 0s;
}

/* ---------- шапка ---------- */

.mk-head { margin: 10px 0 26px; }
.mk-title { font-size: 40px; line-height: 1; font-weight: 700; letter-spacing: -0.04em; }
.mk-sub { margin-top: 10px; font-size: 14.5px; color: var(--mk-muted); }

/* ---------- вкладки: NFT-подарки / Звёзды / Premium / TON ---------- */

.mk-tabs { display: flex; gap: 6px; margin-bottom: 22px; border-bottom: 1px solid var(--mk-line); }
.mk-tab {
    height: 44px; padding: 0 4px; margin-bottom: -1px; background: none; border: 0; border-bottom: 2px solid transparent;
    color: var(--mk-muted); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; transition: color .15s, border-color .15s;
}
.mk-tab:hover { color: var(--mk-text); }
.mk-tab.active { color: var(--mk-text); border-color: var(--mk-red); }

/* ---------- раскладка ---------- */

.mk-layout { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 32px; align-items: start; }

/* Фильтры - колонка без рамки: разделы разделены линией, а не завёрнуты в карточки. */
.mk-side { position: sticky; top: 88px; display: flex; flex-direction: column; max-height: calc(100vh - 104px); }
.mk-side__scroll { overflow-y: auto; padding-right: 10px; margin-right: -10px; scrollbar-width: thin; scrollbar-color: #262626 transparent; }
.mk-side__foot { display: none; }

.mk-group { padding: 18px 0; border-top: 1px solid var(--mk-line); }
.mk-group:first-child { padding-top: 0; border-top: 0; }
.mk-group__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.mk-group__label { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.mk-group__label span { color: var(--mk-muted); font-weight: 500; }
.mk-group__reset { background: none; border: 0; padding: 0; color: var(--mk-muted); font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.mk-group__reset:hover { color: var(--mk-text); }

.mk-find {
    display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; margin-bottom: 6px;
    border-radius: 9px; background: var(--mk-surface); border: 1px solid var(--mk-line);
    color: var(--mk-dim); transition: border-color .2s;
}
.mk-find:focus-within { border-color: var(--mk-line-strong); color: var(--mk-muted); }
.mk-find input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--mk-text); font: inherit; font-size: 13.5px; }
.mk-find input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }

.mk-hint { font-size: 13px; line-height: 1.45; color: var(--mk-dim); }

/* Списки: коллекции, модели, фоны. У каждого своя прокрутка. */
.mk-list {
    display: flex; flex-direction: column; max-height: 296px; overflow-y: auto;
    /* 29.09: без overscroll-behavior: contain - у верха списка колесо докручивает и колонку фильтров (раньше
       список тематик упирался и первая строка оставалась обрезанной) */
    margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; scrollbar-color: #262626 transparent;
}
.mk-row {
    display: flex; align-items: center; gap: 11px; width: 100%; min-height: 46px; padding: 5px 8px 5px 5px;
    border-radius: 9px; background: none; border: 0; color: var(--mk-text); font: inherit; text-align: left;
    cursor: pointer; transition: background .15s;
}
.mk-row:hover { background: var(--mk-surface-2); }
.mk-row[aria-pressed="true"] { background: var(--mk-red-soft); }
.mk-row img { flex: none; width: 36px; height: 36px; border-radius: 7px; object-fit: cover; background: var(--mk-surface-3); }
.mk-row__dot { flex: none; width: 28px; height: 28px; margin: 4px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.mk-row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mk-row__name { font-size: 13.5px; font-weight: 550; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-row__sub { font-size: 12px; color: var(--mk-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.mk-row__n { flex: none; font-size: 12px; color: var(--mk-muted); font-variant-numeric: tabular-nums; }
.mk-row.is-dim .mk-row__name, .mk-row.is-dim .mk-row__n, .mk-row.is-dim img, .mk-row.is-dim .mk-row__dot { opacity: .45; }
.mk-tick { flex: none; color: var(--mk-red); opacity: 0; transition: opacity .15s; }
.mk-row[aria-pressed="true"] .mk-tick { opacity: 1; }
.mk-row[aria-pressed="true"] .mk-row__n { display: none; }

.mk-price { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mk-price input {
    width: 100%; height: 40px; padding: 0 12px; border-radius: 9px; background: var(--mk-surface);
    border: 1px solid var(--mk-line); color: var(--mk-text); font: inherit; font-size: 14px; outline: none;
    font-variant-numeric: tabular-nums; transition: border-color .2s;
}
.mk-price input:focus { border-color: var(--mk-line-strong); }
.mk-price input::placeholder, .mk-find input::placeholder { color: var(--mk-dim); }

.mk-switch {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px; margin-top: 8px;
    padding: 0; background: none; border: 0; color: var(--mk-text); font: inherit; font-size: 14px; font-weight: 550; text-align: left; cursor: pointer;
}
.mk-switch span { display: flex; flex-direction: column; gap: 2px; }
.mk-switch small { font-size: 12px; font-weight: 400; color: var(--mk-dim); }
.mk-switch i { flex: none; position: relative; width: 38px; height: 22px; border-radius: 11px; background: var(--mk-surface-3); transition: background .2s; }
.mk-switch i::after {
    content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%;
    background: #8A8A8A; transition: transform .22s var(--mk-ease), background .2s;
}
.mk-switch[aria-checked="true"] i { background: var(--mk-red); }
.mk-switch[aria-checked="true"] i::after { transform: translateX(16px); background: #fff; }
.mk-group--mono .mk-switch { margin-top: 0; }

/* Кнопки фильтров над сеткой - только на телефоне и планшете. */
.mk-quick { display: none; }
.mk-chip {
    display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px 0 14px; border-radius: 10px; cursor: pointer;
    background: var(--mk-surface); border: 1px solid var(--mk-line-strong); color: var(--mk-text);
    font: inherit; font-size: 14px; font-weight: 550; white-space: nowrap; transition: background .15s, border-color .15s;
}
.mk-chip b { font-weight: 650; color: #FF4A53; font-variant-numeric: tabular-nums; }
.mk-chip b:empty { display: none; }
.mk-caret { color: var(--mk-dim); transition: transform .2s var(--mk-ease); }
.mk-chip[aria-expanded="true"] { border-color: var(--mk-text); }
.mk-chip[aria-expanded="true"] .mk-caret { transform: rotate(180deg); }
.mk-chip.is-set, .mk-chip[aria-pressed="true"] { border-color: var(--mk-red-line); background: var(--mk-red-soft); }
#mkQuickMono { padding-right: 14px; }

/* ---------- над сеткой ---------- */

.mk-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; min-height: 38px; }
.mk-active { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 16px; }
.mk-active:empty { display: none; }

/* На ПК цена и переключатели над сеткой; в колонке фильтров их нет, чтобы не мотать вниз. */
.mk-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.mk-top__price {
    display: flex; align-items: center; height: 38px; border-radius: 10px; background: var(--mk-surface);
    border: 1px solid var(--mk-line-strong); overflow: hidden;
}
.mk-top__price span { padding: 0 10px 0 13px; font-size: 13.5px; color: var(--mk-muted); white-space: nowrap; }
.mk-top__price input {
    width: 86px; height: 100%; padding: 0 10px; background: none; border: 0; border-left: 1px solid var(--mk-line);
    color: var(--mk-text); font: inherit; font-size: 14px; outline: none; font-variant-numeric: tabular-nums;
}
.mk-top__price input:focus { background: var(--mk-surface-2); }
.mk-top__price input::placeholder { color: var(--mk-dim); }
.mk-top .mk-chip { padding: 0 14px; }
@media (min-width: 1024px) {
    .mk-side [data-group="price"], .mk-side [data-group="mono"] { display: none; }
    .mk-side [data-group="back"] { padding-bottom: 0; }
}
.mk-tag {
    display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 9px 0 11px; border-radius: 7px;
    background: var(--mk-surface-2); border: 0; color: var(--mk-text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.mk-tag svg { color: var(--mk-dim); }
.mk-tag:hover svg { color: var(--mk-text); }
.mk-tag--clear { background: none; padding: 0 4px; color: var(--mk-muted); text-decoration: underline; text-underline-offset: 3px; }
.mk-toolbar__right { display: flex; align-items: center; gap: 14px; flex: none; }
.mk-count { font-size: 13.5px; color: var(--mk-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mk-sort select {
    height: 38px; padding: 0 32px 0 12px; border-radius: 9px; background-color: var(--mk-surface);
    border: 1px solid var(--mk-line); color: var(--mk-text); font: inherit; font-size: 13.5px; cursor: pointer;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A0A0A0' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center;
}

/* ---------- карточки подарков ---------- */

.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 22px 14px; transition: opacity .2s; }
.mk-grid.is-busy { opacity: .5; pointer-events: none; }
.mk-lot {
    display: flex; flex-direction: column; padding: 0; text-align: left; cursor: pointer;
    background: none; border: 0; color: var(--mk-text); font: inherit;
}
.mk-lot__media {
    position: relative; display: block; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--mk-surface-2);
    box-shadow: inset 0 0 0 1px var(--mk-line); transition: box-shadow .2s;
}
.mk-lot__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mk-lot__flag {
    position: absolute; left: 8px; top: 8px; padding: 4px 7px; border-radius: 5px;
    font-size: 11px; font-weight: 600; line-height: 1; background: rgba(8, 8, 8, 0.78); color: var(--mk-text);
}
.mk-lot__flag--lock { color: var(--mk-muted); }
.mk-lot__coll { display: block; margin-top: 11px; font-size: 12px; color: var(--mk-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-lot__coll span { font-variant-numeric: tabular-nums; }
.mk-lot__name { display: block; margin-top: 3px; font-size: 15px; font-weight: 650; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-lot__attrs { display: block; margin-top: 3px; font-size: 12.5px; color: var(--mk-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-lot__price { display: block; margin-top: 8px; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
@media (hover: hover) {
    .mk-lot:hover .mk-lot__media { box-shadow: inset 0 0 0 1.5px var(--mk-red-line); }
    .mk-lot:hover .mk-lot__price { color: #FF4A53; }
}
.mk-lot--ghost { pointer-events: none; }
.mk-lot--ghost .mk-lot__media, .mk-ghost {
    background: linear-gradient(90deg, var(--mk-surface) 0%, var(--mk-surface-2) 50%, var(--mk-surface) 100%);
    background-size: 200% 100%; animation: mk-shimmer 1.4s linear infinite;
}
.mk-ghost { height: 12px; border-radius: 4px; margin-top: 10px; }
@keyframes mk-shimmer { to { background-position: -200% 0; } }

.mk-note { padding: 14px 4px; font-size: 13px; color: var(--mk-dim); }
.mk-empty { padding: 64px 20px; max-width: 460px; margin: 0 auto; text-align: center; }
.mk-empty p { font-size: 15px; line-height: 1.5; color: var(--mk-muted); }
.mk-empty__actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.mk-clear {
    height: 40px; padding: 0 16px; border-radius: 9px; background: var(--mk-surface-2);
    border: 1px solid var(--mk-line-strong); color: var(--mk-text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.mk-clear:hover { border-color: var(--mk-muted); }
.mk-again {
    display: block; margin: 32px auto 0; height: 44px; padding: 0 24px; cursor: pointer;
    border-radius: 10px; background: var(--mk-surface); border: 1px solid var(--mk-line-strong);
    color: var(--mk-text); font: inherit; font-size: 14px; font-weight: 600;
}
.mk-again:hover { border-color: var(--mk-muted); }

/* ---------- карточка подарка ---------- */

.mk-sheet { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.mk-sheet[hidden] { display: none; }
.mk-sheet__fog { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.76); animation: mk-fade .25s var(--mk-ease); }
.mk-sheet__card {
    position: relative; display: grid; grid-template-columns: 380px 1fr; width: min(860px, 100%); max-height: calc(100vh - 40px);
    overflow: auto; border-radius: 20px; background: var(--mk-surface); box-shadow: 0 0 0 1px var(--mk-line-strong), 0 40px 90px -30px #000;
    animation: mk-rise .3s var(--mk-ease);
}
.mk-sheet__close {
    position: absolute; right: 12px; top: 12px; z-index: 2; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
    border-radius: 10px; background: rgba(10, 10, 10, 0.66); border: 0; color: var(--mk-text); cursor: pointer;
}
.mk-sheet__media { position: relative; min-height: 380px; background: var(--mk-surface-2); overflow: hidden; cursor: pointer; }
/* живой подарок (gift-live.js): слой анимации поверх фото, проявляется, когда готов */
.gl-layer { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; opacity: 0; transition: opacity .3s ease; pointer-events: none; }
.gl-bg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.gl-model { position: absolute; }
.gl-layer svg { display: block; width: 100% !important; height: 100% !important; }
.gl-on > .gl-layer { opacity: 1; }
.mk-sheet__media img { width: 100%; height: 100%; min-height: 380px; object-fit: cover; display: block; }
.mk-sheet__body { display: flex; flex-direction: column; padding: 28px 28px 24px; }
.mk-sheet__coll { font-size: 13px; color: var(--mk-muted); font-variant-numeric: tabular-nums; }
.mk-sheet__title { margin-top: 6px; font-size: 30px; line-height: 1.05; font-weight: 700; letter-spacing: -0.035em; }
.mk-sheet__state { margin-top: 8px; font-size: 13.5px; color: var(--mk-muted); }
.mk-sheet__state.is-locked { color: var(--mk-text); }
.mk-traits { margin: 22px 0 24px; border-top: 1px solid var(--mk-line); }
.mk-traits div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--mk-line); }
.mk-traits dt { font-size: 13px; color: var(--mk-muted); }
.mk-traits dd { font-size: 14.5px; font-weight: 600; text-align: right; }
.mk-traits dd small { margin-left: 8px; font-size: 12.5px; font-weight: 500; color: var(--mk-dim); font-variant-numeric: tabular-nums; }
.mk-sheet__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-top: auto; }
.mk-sheet__price span { font-size: 32px; font-weight: 700; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.mk-sheet__price small { font-size: 13px; color: var(--mk-muted); }
.mk-sheet__actions { display: flex; gap: 8px; margin-top: 16px; }
.mk-buy {
    flex: 1; height: 50px; border-radius: 11px; background: var(--mk-red); border: 0; color: #fff;
    font: inherit; font-size: 15.5px; font-weight: 700; cursor: pointer; transition: background .2s;
}
.mk-buy:hover { background: #F2141F; }
.mk-open {
    display: inline-flex; align-items: center; height: 50px; padding: 0 18px; border-radius: 11px;
    background: var(--mk-surface-2); border: 1px solid var(--mk-line-strong); color: var(--mk-text);
    font-size: 14px; font-weight: 600;
}
.mk-sheet__note { margin-top: 12px; font-size: 12.5px; line-height: 1.45; color: var(--mk-dim); }

@keyframes mk-fade { from { opacity: 0; } }
@keyframes mk-rise { from { opacity: 0; transform: translateY(10px); } }

.mk-lot:focus-visible, .mk-row:focus-visible, .mk-switch:focus-visible, .mk-chip:focus-visible,
.mk-tag:focus-visible, .mk-buy:focus-visible, .mk-open:focus-visible, .mk-group__reset:focus-visible {
    outline: 2px solid rgba(229, 9, 20, 0.75); outline-offset: 2px;
}

/* ---------- телефон и планшет: каждый фильтр раскрывается списком под кнопками ---------- */

@media (max-width: 1023px) {
    .mk-head { margin-bottom: 18px; }
    .mk-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
    .mk-layout { display: block; position: relative; }
    .mk-side {
        position: absolute; left: 0; right: 0; top: 0; z-index: 40; max-height: none;
        border-radius: 14px; background: var(--mk-surface); box-shadow: 0 0 0 1px var(--mk-line-strong), 0 28px 60px -18px #000;
        opacity: 0; visibility: hidden; transform: translateY(-6px);
        transition: opacity .18s, transform .18s var(--mk-ease), visibility 0s linear .18s;
    }
    .mk-side.is-open { opacity: 1; visibility: visible; transform: none; transition: opacity .18s, transform .18s var(--mk-ease); }
    .mk-side__scroll { padding: 14px 14px 4px; margin: 0; max-height: min(64vh, 560px); }
    .mk-side .mk-group { display: none; padding: 0; border: 0; }
    .mk-side[data-show="theme"] [data-group="theme"],
    .mk-side[data-show="coll"] [data-group="coll"],
    .mk-side[data-show="model"] [data-group="model"],
    .mk-side[data-show="back"] [data-group="back"],
    .mk-side[data-show="price"] [data-group="price"] { display: block; }
    .mk-side .mk-group__head { display: none; }
    .mk-list { max-height: min(46vh, 420px); }
    .mk-row { min-height: 50px; }
    .mk-side__foot {
        display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 10px 14px 14px;
        border-top: 1px solid var(--mk-line);
    }
    .mk-apply { height: 44px; border-radius: 10px; background: var(--mk-red); border: 0; color: #fff; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
    .mk-toolbar { flex-wrap: wrap; }
    .mk-top { display: none; }
    .mk-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (max-width: 800px) {
    .mk-title { font-size: 32px; }
    .mk-sheet { padding: 0; align-items: flex-end; }
    .mk-sheet__card { grid-template-columns: 1fr; border-radius: 20px 20px 0 0; max-height: 92vh; }
    .mk-sheet__media, .mk-sheet__media img { min-height: 0; height: 300px; }
}
@media (max-width: 520px) {
    .mk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 10px; }
    .mk-lot__media { border-radius: 12px; }
    .mk-lot__name { font-size: 14px; }
    .mk-lot__price { font-size: 16px; }
    .mk-toolbar__right { width: 100%; justify-content: space-between; }
    .mk-sheet__body { padding: 22px 18px calc(20px + env(safe-area-inset-bottom, 0px)); }
    .mk-chip { height: 36px; padding: 0 10px 0 12px; font-size: 13.5px; }
}
@media (prefers-reduced-motion: reduce) {
    .mk-sheet__fog, .mk-sheet__card, .mk-side, .mk-caret { animation: none; transition: none; }
    .mk-lot--ghost .mk-lot__media, .mk-ghost { animation: none; }
}

/* ошибка выдачи (26.09) */
.mk-err { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; padding: 14px 16px;
    border-radius: 12px; border: 1px solid rgba(229, 9, 20, .35); background: rgba(229, 9, 20, .08); }
.mk-err[hidden] { display: none; }
.mk-err p { margin: 0; font-size: 14px; line-height: 1.45; flex: 1 1 220px; }
.mk-err__retry { min-height: 44px; padding: 0 18px; border-radius: 10px; border: 0; background: #E50914; color: #fff; font-weight: 700; font-size: 14px; line-height: 1; font-family: inherit; cursor: pointer; }

/* ---------- ряды (29.09): свой ряд и готовые ряды; static/js/rows.js ---------- */

.rw-h { font-size: 22px; line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; }
.rw-lead { margin-top: 6px; font-size: 14px; line-height: 1.5; color: var(--mk-muted); }

/* Ряд - полка, как витрина подарков в профиле Telegram: три квадрата на одной подложке */
.rw-shelf {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 8px;
    border-radius: 18px; background: var(--mk-surface); box-shadow: inset 0 0 0 1px var(--mk-line);
}
.rw-cell { position: relative; display: flex; flex-direction: column; min-width: 0; }
.rw-cell__media {
    position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 12px;
    overflow: hidden; background: var(--mk-surface-3);
}
button.rw-cell__media { cursor: pointer; }
.rw-cell__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rw-cell__media.mk-ghost { height: auto; margin: 0; }
.rw-cell--empty {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 12px;
    background: var(--mk-surface-2); box-shadow: inset 0 0 0 1px var(--mk-line); color: var(--mk-dim); cursor: pointer;
    transition: color .15s, box-shadow .15s;
}
.rw-cell--empty:hover { color: var(--mk-text); box-shadow: inset 0 0 0 1px var(--mk-line-strong); }
.rw-cell__del {
    position: absolute; top: 6px; right: 6px; z-index: 2; width: 26px; height: 26px; display: flex; align-items: center;
    justify-content: center; border-radius: 50%; background: rgba(10, 10, 10, 0.72); border: 0; color: var(--mk-text);
    cursor: pointer; transition: background .15s;
}
.rw-cell__del:hover { background: rgba(10, 10, 10, 0.92); }
/* расширенная зона нажатия без увеличения кружка */
.rw-cell__del::after { content: ""; position: absolute; inset: -8px; }
.rw-cell--sold .rw-cell__media img { filter: grayscale(1); opacity: .45; }
.rw-cell--sold .rw-cell__price { text-decoration: line-through; }
.rw-cell__badge {
    position: absolute; left: 6px; bottom: 6px; padding: 4px 7px; border-radius: 6px; background: rgba(8, 8, 8, 0.82);
    color: var(--mk-text); font-size: 11px; font-weight: 600; line-height: 1;
}
.rw-cell__name { margin-top: 7px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rw-cell__price { margin-top: 1px; font-size: 12.5px; color: var(--mk-muted); font-variant-numeric: tabular-nums; }

.rw-mine__body { display: grid; grid-template-columns: minmax(0, 560px) 280px; gap: 28px; align-items: start; margin-top: 16px; }
.rw-rows { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rw-side { display: flex; flex-direction: column; gap: 10px; }
.rw-side__sum { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; color: var(--mk-muted); }
.rw-side__sum b { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; color: var(--mk-text); font-variant-numeric: tabular-nums; }
.rw-side__buy { flex: none; }
.rw-side__buy:disabled { background: var(--mk-surface-3); color: var(--mk-dim); cursor: not-allowed; }
.rw-side__hint { font-size: 13px; line-height: 1.45; color: var(--mk-dim); }
.rw-side__tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.rw-side__add {
    align-self: flex-start; padding: 6px 0; background: none; border: 0; color: var(--mk-text); font: inherit; font-size: 14px;
    font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-color: var(--mk-red-line); text-underline-offset: 4px;
}

.rw-btn {
    height: 40px; padding: 0 14px; border-radius: 10px; background: var(--mk-surface-2); border: 1px solid var(--mk-line-strong);
    color: var(--mk-text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
    font-variant-numeric: tabular-nums; transition: border-color .15s, opacity .15s;
}
.rw-btn:hover:not(:disabled) { border-color: var(--mk-muted); }
.rw-btn:disabled { opacity: .4; cursor: not-allowed; }
.rw-btn.is-busy { opacity: .6; }
.rw-btn--buy { background: var(--mk-red); border-color: var(--mk-red); color: #fff; }
.rw-btn--buy:hover:not(:disabled) { background: #F2141F; border-color: #F2141F; }

.rw-ready { margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--mk-line); }
.rw-ready__head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; }
.rw-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.rw-kinds .mk-chip { padding: 0 14px; }
.rw-kinds .mk-chip[data-rw-kind="theme"] { padding-right: 12px; }
.rw-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px 16px; margin-top: 18px; }
.rw-list > .mk-note { grid-column: 1 / -1; padding-left: 0; }
.rw-card { display: flex; flex-direction: column; min-width: 0; }
.rw-shelf--card { gap: 6px; padding: 6px; border-radius: 16px; }
.rw-shelf--card .rw-cell__media { border-radius: 11px; }
.rw-card__body { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 10px; }
.rw-card__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rw-card__text b { font-size: 15px; font-weight: 650; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rw-card__text span { font-size: 12.5px; color: var(--mk-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rw-card__price { flex: none; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.rw-card__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }

/* кнопка «В ряд» в карточке подарка */
.mk-torow {
    flex: none; height: 50px; padding: 0 18px; border-radius: 11px; background: var(--mk-surface-2); border: 1px solid var(--mk-line-strong);
    color: var(--mk-text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s;
}
.mk-torow:hover { border-color: var(--mk-muted); }
.mk-torow[aria-pressed="true"] { border-color: var(--mk-red-line); background: var(--mk-red-soft); }

/* плашка «Ряд · 2 из 3» внизу маркета */
.rw-tray {
    position: fixed; left: 50%; bottom: 24px; z-index: 1000; transform: translateX(-50%);
    display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 24px); padding: 8px 14px 8px 8px;
    border-radius: 16px; background: #161616; border: 1px solid rgba(255, 255, 255, 0.14); color: #F5F5F5;
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.9); font-family: "Onest", -apple-system, "Segoe UI", Roboto, sans-serif;
    cursor: pointer; animation: rw-tray-in .25s cubic-bezier(0.22, 0.8, 0.26, 1);
}
.rw-tray[hidden] { display: none; }
.rw-tray:hover { border-color: rgba(255, 255, 255, 0.28); }
.rw-tray__thumbs { display: flex; gap: 4px; }
.rw-tray__thumbs img, .rw-tray__thumbs i { display: block; width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background: #1D1D1D; }
.rw-tray__thumbs i { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
.rw-tray__text { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.rw-tray__text b { font-size: 14px; font-weight: 650; white-space: nowrap; }
.rw-tray__text small { font-size: 12.5px; color: #9A9A9A; font-variant-numeric: tabular-nums; }
@keyframes rw-tray-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* окно выбора тематики - как карточка подарка: по центру на ПК, шторка снизу на телефоне */
.rw-modal {
    position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 20px;
    color: var(--mk-text); font-family: "Onest", -apple-system, "Segoe UI", Roboto, sans-serif;
}
.rw-modal[hidden] { display: none; }
.rw-modal__fog { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.76); animation: mk-fade .2s var(--mk-ease); }
.rw-modal__card {
    position: relative; display: flex; flex-direction: column; border-radius: 20px; background: var(--mk-surface);
    box-shadow: 0 0 0 1px var(--mk-line-strong), 0 40px 90px -30px #000; animation: mk-rise .25s var(--mk-ease);
}
.rw-choose__card { width: min(440px, 100%); max-height: min(640px, calc(100vh - 40px)); padding-bottom: 8px; }
.rw-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px 22px; }
.rw-modal__title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.rw-modal__close {
    flex: none; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: 10px; background: var(--mk-surface-2); border: 0; color: var(--mk-text); cursor: pointer;
}
.rw-choose__find { margin: 0 16px 8px; }
.rw-choose__list { flex: 1; min-height: 0; max-height: none; margin: 0 10px; padding: 0 6px 6px; overscroll-behavior: contain; }

.rw-cell__media:focus-visible, .rw-cell--empty:focus-visible, .rw-cell__del:focus-visible, .rw-btn:focus-visible,
.rw-side__add:focus-visible, .mk-torow:focus-visible, .rw-tray:focus-visible, .rw-modal__close:focus-visible {
    outline: 2px solid rgba(229, 9, 20, 0.75); outline-offset: 2px;
}

@media (max-width: 1023px) {
    .rw-mine__body { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .rw-side { max-width: 560px; }
}
@media (max-width: 800px) {
    .rw-modal { align-items: flex-end; padding: 0; }
    .rw-modal__card { width: 100%; border-radius: 20px 20px 0 0; }
    .rw-choose__card { max-height: 80dvh; padding-bottom: env(safe-area-inset-bottom, 0px); }
    .mk-torow { height: 46px; width: 100%; }
}
@media (max-width: 767px) {
    .rw-tray { left: 12px; right: 12px; transform: none; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); max-width: none; }
    .rw-tray__text { flex: 1; min-width: 0; }
    @keyframes rw-tray-in { from { opacity: 0; transform: translateY(8px); } }
    body.rw-has-tray .to-top { bottom: calc(140px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 520px) {
    .rw-h { font-size: 20px; }
    .rw-shelf { gap: 6px; padding: 6px; border-radius: 15px; }
    .rw-cell__media, .rw-cell--empty { border-radius: 10px; }
    .rw-cell__name { font-size: 12.5px; }
    .rw-list { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
    .rw-modal__fog, .rw-modal__card, .rw-tray { animation: none; }
}
