/* Гардероб — косметика за бриллианты (webapp/wardrobe.js). Нуар: красный задник сцены, как на итогах;
   красный — только главная кнопка (в нижней панели) и примеряемая плитка. Цвета — только токены app.css. */

/* ── шапка: заголовок, «i», бриллианты ── */
.wd-head { margin-bottom: 14px; }
.wd-gems {
  margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 10px 0 12px; border: 1px solid var(--line); border-radius: var(--r-pill);
  font-weight: 600; font-size: 15px; transition: background-color 150ms ease;
}
.wd-gems .ic { width: 16px; height: 16px; color: var(--muted); }
.wd-gems .wd-plus {
  display: grid; place-items: center; width: 26px; height: 26px; margin-inline-start: 2px; border-radius: 50%;
  background: var(--text); color: var(--ink);
}
.wd-gems .wd-plus .ic { width: 14px; height: 14px; color: currentColor; stroke-width: 2.25; }
.wd-gems:active { background: var(--raise); }

/* ── верх экрана: сцена и вкладки остаются на месте, плитки листаются под ними — примерку видно всегда ── */
.wd-top {
  position: sticky; top: 0; z-index: 5; isolation: isolate;
  margin: 0 -16px; padding: 8px 16px 0; background: var(--bg);
}

/* ── сцена: задник со складками, луч, пол; герой стоит ступнями на линии пола (90 % высоты) ── */
.wd-stage {
  --st-fold: rgba(12, 9, 8, .2);
  --st-floor: var(--raise);
  --st-edge: #2E2829;
  --st-light: rgba(255, 238, 208, .12);
  --st-pool: rgba(255, 238, 208, .16);
  position: relative; isolation: isolate; overflow: hidden;
  aspect-ratio: 16 / 10; max-height: 36dvh; width: 100%; border-radius: 20px; background: var(--disc);
}
:root[data-theme="light"] .wd-stage {
  --st-fold: rgba(110, 92, 76, .14);
  --st-floor: #8F735C;
  --st-edge: #6E5C4C;
  --st-light: rgba(255, 252, 247, .45);
  --st-pool: rgba(255, 252, 247, .55);
}
.wd-stage > * { position: absolute; }
.wd-set { inset: 0; width: 100%; height: 100%; }
.wd-set path { fill: var(--st-fold); }
.wd-beam { inset: -4% 24% 6%; background: var(--st-light); clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%); }
.wd-floor { inset: auto 0 0; height: 10%; background: var(--st-floor); box-shadow: inset 0 2px 0 var(--st-edge); }
.wd-floor::before { content: ''; position: absolute; left: 28%; right: 28%; top: -9px; height: 18px; border-radius: 50%; background: var(--st-pool); }
.wd-fig { inset: 0; z-index: 1; animation: wd-in 260ms var(--ease-enter) backwards; }
@keyframes wd-in { from { opacity: 0; transform: translateY(6px); } }

/* Полоса кадров героя: окно в один кадр, кадры сдвигаются steps(N). Высота — 92 % сцены, ступни (--ay) — на полу. */
.wd-spr {
  position: absolute; overflow: hidden; height: 92%; aspect-ratio: var(--fw) / var(--fh);
  left: 50%; top: calc(90% - 92% * var(--ay) / var(--fh));
  transform: translateX(calc(var(--ax) / var(--fw) * -100%));
}
.wd-strip {
  position: absolute; left: 0; top: 0; height: 100%; width: calc(var(--n) * 100%);
  background-size: 100% 100%; background-repeat: no-repeat;
  animation: wd-play var(--d) steps(var(--n)) infinite;
}
@keyframes wd-play { from { transform: translateX(0); } to { transform: translateX(-100%); } }
/* Без картинок героя — векторный персонаж в рост бюста. */
.wd-vec { position: absolute; left: 50%; bottom: 10%; height: 82%; aspect-ratio: 1; transform: translateX(-50%); }
.wd-vec .ch { display: block; width: 100%; height: 100%; overflow: visible; }
/* Дом: опора кадра (224, 448 из 512) — на линии пола. */
.wd-house { position: absolute; height: 92%; width: auto; aspect-ratio: 1; left: 50%; top: calc(90% - 92% * .875); transform: translateX(-43.75%); }
.wd-house.is-default { opacity: .55; }

/* ── на сцене: чей вид (слева вверху), что на герое (справа вверху), стрелки — другой герой ── */
.wd-chip {
  z-index: 2; top: 10px; max-width: 46%; height: 28px; padding: 0 10px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; background: var(--bg); color: var(--text);
  font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wd-chip-who { inset-inline-start: 10px; font: 600 15px/1 var(--font-display); }
.wd-chip-now { inset-inline-end: 10px; color: var(--muted); }
.wd-arrow {
  z-index: 2; top: 50%; width: 44px; height: 44px; margin-top: -22px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text); background: rgba(12, 11, 11, .32);
  transition: background-color 150ms ease;
}
.wd-arrow.is-prev { inset-inline-start: 8px; }
.wd-arrow.is-next { inset-inline-end: 8px; }
.wd-arrow:active { background: rgba(12, 11, 11, .55); }
:root[data-theme="light"] .wd-arrow { background: rgba(255, 252, 247, .6); }
:root[data-theme="light"] .wd-arrow:active { background: rgba(255, 252, 247, .9); }

/* ── вкладки слотов: ряд пилюль, листается вбок; выбранная — светлая ── */
.wd-tabs {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -16px; padding: 10px 16px 12px; scroll-padding-inline: 16px;
}
.wd-tabs::-webkit-scrollbar { display: none; }
.wd-tab {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 16px;
  border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: 14px;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.wd-tab .ic { width: 18px; height: 18px; }
.wd-tab:active { background: var(--raise); }
.wd-tab[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--ink); }

/* ── плитки: иконка вещи, название, цена или состояние ── */
.wd-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.wd-tile {
  position: relative; display: grid; grid-template-rows: auto auto 1fr; justify-items: center; gap: 4px;
  padding: 6px 6px 10px; border-radius: 14px; background: var(--raise); text-align: center;
  transition: background-color 150ms ease, transform 120ms var(--ease-press);
}
.wd-tile:active { transform: scale(.97); }
.wd-tile.is-sel { box-shadow: inset 0 0 0 2px var(--red); }
.wd-ic {
  position: relative; width: 100%; aspect-ratio: 1; border-radius: 10px; background: var(--raise-2);
  display: grid; place-items: center; overflow: hidden;
}
.wd-ic img { width: 86%; height: 86%; object-fit: contain; }
.wd-glyph { width: 36%; height: 36%; color: var(--muted); stroke-width: 1.5; }
.wd-name {
  font-size: 13px; font-weight: 600; line-height: 1.25; min-height: 2.5em; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-wrap: balance;
}
.wd-st { align-self: end; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 1; color: var(--muted); }
.wd-st .ic { width: 14px; height: 14px; }
.wd-st.is-on { color: var(--text); font-weight: 600; }
.wd-price { color: var(--text); font-weight: 600; font-size: 13px; }
.wd-tier {
  position: absolute; top: 6px; inset-inline-start: 6px; display: inline-flex; align-items: center;
  height: 18px; padding: 0 6px; border-radius: var(--r-pill); background: var(--bg); color: var(--muted);
  font-size: 11px; font-weight: 600;
}
/* Особая — светлым по тёмному с тонкой рамкой (красный — только главная кнопка и выбор). */
.wd-tier.is-special { color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

/* Метки на иконке плитки: скидка (светлая на тёмном), «Новинка», «Хит» — внизу слева, чтобы не спорить с редкостью. */
.wd-tag {
  position: absolute; bottom: 6px; inset-inline-start: 6px; z-index: 1; display: inline-flex; align-items: center;
  height: 18px; padding: 0 6px; border-radius: var(--r-pill); background: var(--bg); color: var(--text);
  font-size: 11px; font-weight: 600; line-height: 1;
}
.wd-tag.is-off { background: var(--text); color: var(--ink); }
/* Цена: бриллианты сейчас и зачёркнутая обычная. */
.wd-cost { display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-weight: 600; font-size: 13px; }
.wd-cost .ic { width: 14px; height: 14px; color: var(--muted); }
.wd-cost s { color: var(--muted); font-weight: 500; font-size: 12px; }
.wd-cost-v { display: inline-flex; align-items: center; gap: 4px; }

/* ── витрина: предложение дня, наборы, полка особых, ряды новинок и хитов ── */
.wd-show > .sec-row:first-child { margin-top: 12px; }
.wd-show .sec-row { margin: 24px 0 10px; }
.wd-ends { display: inline-flex; align-items: center; }
.wd-offer {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px;
  width: 100%; padding: 10px; border-radius: 16px; background: var(--raise); text-align: start;
  transition: background-color 150ms ease, transform 120ms var(--ease-press);
}
.wd-offer:active { transform: scale(.985); }
.wd-offer.is-sel { box-shadow: inset 0 0 0 2px var(--red); }
.wd-offer-ics { display: grid; grid-auto-flow: column; gap: 4px; }
.wd-offer-ics .wd-ic { width: 52px; border-radius: 10px; }
.wd-offer-ics .wd-ic.is-have { opacity: .45; }
.wd-offer-main { display: grid; gap: 4px; min-width: 0; }
.wd-offer-name { font: 600 18px/1.15 var(--font-display); }
.wd-offer-sub { color: var(--muted); font-size: 12px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wd-offer-cost { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.wd-offer-cost .wd-tag { position: static; height: 20px; font-size: 12px; }
/* Предложение дня — крупно: вещи сверху во всю ширину, текст под ними. */
.wd-offer.is-deal { grid-template-columns: 1fr; padding: 12px; background: var(--card); box-shadow: inset 0 0 0 1px var(--card-line); }
.wd-offer.is-deal.is-sel { box-shadow: inset 0 0 0 2px var(--red); }
.wd-offer.is-deal .wd-offer-ics { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wd-offer.is-deal .wd-offer-ics.n1 { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.wd-offer.is-deal .wd-offer-ics .wd-ic { width: 100%; }
.wd-offer.is-deal .wd-offer-ics.n1 .wd-ic { width: min(46%, 168px); }
.wd-offer.is-deal .wd-offer-name { font-size: 22px; }
.wd-offer.is-deal .wd-cost { font-size: 16px; }
.wd-offer.is-deal .wd-cost b { font: 600 20px/1 var(--font-display); }
/* Наборы — две колонки: три вещи рядом, название, состав, цена. */
.wd-sets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.wd-sets .wd-offer { grid-template-columns: 1fr; align-content: start; }
.wd-sets .wd-offer-ics { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: row; }
.wd-sets .wd-offer-ics .wd-ic { width: 100%; border-radius: 8px; }
.wd-sets .wd-offer-name { font-size: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Ряды плиток листаются вбок; край следующей плитки подсказывает, что там ещё есть. */
.wd-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 16px) / 3.25); gap: 8px;
  overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; scroll-padding-inline: 16px;
}
.wd-row::-webkit-scrollbar { display: none; }
/* Полка особых: тёмная карта и луч прожектора сверху, как на сцене. */
.wd-shelf {
  --sh-light: rgba(255, 238, 208, .07);
  position: relative; isolation: isolate; overflow: hidden; margin: 24px -4px 0; padding: 2px 4px 12px;
  border-radius: 18px; background: var(--card); box-shadow: inset 0 0 0 1px var(--card-line);
}
:root[data-theme="light"] .wd-shelf { --sh-light: rgba(255, 252, 247, .7); }
.wd-shelf::before {
  content: ''; position: absolute; z-index: -1; inset: 0 18% 30%; background: var(--sh-light);
  clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
}
.wd-shelf .sec-row { margin: 12px 8px 10px; }
.wd-shelf .sec { display: inline-flex; align-items: center; gap: 6px; }
.wd-shelf .sec .ic { width: 16px; height: 16px; color: var(--muted); }
.wd-shelf .wd-row { margin: 0 -4px; padding: 0 12px; }
.wd-shelf .wd-tile { background: var(--card-2); }
/* Светлая тема: на кремовой карте мелкий серый текст плиток — на светлом (контраст 6,1:1 вместо 4,4:1). */
:root[data-theme="light"] .wd-shelf .wd-tile { background: var(--raise); }

/* ── нижний лист покупки ── */
.wd-sheet { display: grid; justify-items: center; text-align: center; }
.wd-sheet-ics { display: flex; gap: 8px; margin: 4px 0 12px; }
.wd-sheet-ic { width: 112px; height: 112px; border-radius: 20px; background: var(--raise-2); display: grid; place-items: center; overflow: hidden; }
.wd-sheet-ics.n3 .wd-sheet-ic { width: 88px; height: 88px; border-radius: 16px; }
.wd-sheet-ic.is-have { opacity: .45; }
.wd-sheet-ic img { width: 90%; height: 90%; object-fit: contain; }
.wd-sheet-ic .wd-glyph { width: 44%; height: 44%; }
.wd-sheet .modal-title { margin-bottom: 0; }
.wd-sheet .team { margin: 6px 0 4px; }
.wd-sheet-sub { color: var(--muted); font-size: 13px; margin: 6px 0 2px; text-wrap: balance; }
.wd-sheet-price { margin: 6px 0 0; }
.wd-sheet-price .wd-cost { font-size: 16px; }
.wd-after { color: var(--muted); font-size: 14px; margin: 4px 0 16px; text-align: center; }
.wd-sheet .btn-ghost { margin-top: 4px; }

/* ═════ «Пополнить» (webapp/topup.js): «+» у кошелька, пакеты, обмен, награда дня, оплата сервисом ═════ */
.tp-plus {
  position: relative; flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--text); color: var(--ink); transition: transform 120ms var(--ease-press);
}
.tp-plus::after { content: ''; position: absolute; inset: -8px; }
.tp-plus .ic { width: 16px; height: 16px; stroke-width: 2.25; color: currentColor; }
.tp-plus:active { transform: scale(.92); }
.wtile .tp-plus { margin-inline-start: auto; }
.wallet .tp-plus .ic { color: currentColor; }

.tp:focus { outline: none; }
.tp-head { display: flex; align-items: center; gap: 4px; min-height: 44px; }
.tp-head .modal-title { margin: 0; }
.tp-bal { margin-inline-start: auto; display: inline-flex; gap: 10px; font-weight: 600; font-size: 14px; }
.tp-bal > span { display: inline-flex; align-items: center; gap: 4px; }
.tp-bal .ic { color: var(--muted); }
.tp-back { flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin-inline-start: -10px; border-radius: 50%; color: var(--text); }
.tp-back:active { background: var(--raise-2); }
.tp-short { margin: 8px 0 0; font-size: 14px; font-weight: 600; color: var(--text); }
/* вне Telegram: «Оплата Telegram Stars — откроется Telegram» */
.tp-note { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.tp-note .ic { flex: none; width: 16px; height: 16px; }
.tp-wait .tp-note { margin: 0; justify-content: center; }
.tp .sec-row { margin: 20px 0 10px; }
.tp > .btn-ghost { margin-top: 12px; }

.tp-promos { display: grid; gap: 8px; margin-bottom: 10px; }
.tp-promo { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: 12px; }
.tp-off { flex: none; display: inline-flex; align-items: center; height: 28px; padding: 0 8px; border-radius: 8px; background: var(--text); color: var(--ink); font: 600 16px/1 var(--font-display); }
.tp-promo-t { display: grid; gap: 2px; min-width: 0; }
.tp-promo-t b { font-size: 14px; font-weight: 600; line-height: 1.3; }
.tp-promo-t small { color: var(--muted); font-size: 12px; }

.tp-packs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tp-pack {
  display: grid; align-content: start; gap: 6px; min-height: 104px; padding: 14px 12px 12px; border-radius: 14px;
  background: var(--raise); text-align: start; transition: background-color 150ms ease, transform 120ms var(--ease-press);
}
.modal .tp-pack { background: var(--raise-2); }
.tp-pack:active { transform: scale(.97); }
.tp-pack.is-wide { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; min-height: 0; align-items: center; column-gap: 12px; }
.tp-pack.is-wide .tp-price { grid-column: 2; grid-row: 1 / span 2; }
.tp-amt { display: inline-flex; align-items: center; gap: 6px; }
.tp-amt .ic { width: 20px; height: 20px; color: var(--muted); }
.tp-amt b { font: 600 28px/1 var(--font-display); }
.tp-x2 { display: inline-flex; align-items: center; height: 18px; padding: 0 5px; border-radius: 6px; background: var(--text); color: var(--ink); font-size: 11px; font-weight: 700; }
.tp-bonus { min-height: 16px; color: var(--muted); font-size: 12px; font-weight: 600; }
.tp-price { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 2px 6px; font-size: 15px; }
.tp-price .ic { width: 14px; height: 14px; color: var(--muted); align-self: center; margin-inline-end: -2px; }
.tp-price b { font-weight: 600; }
.tp-price s { color: var(--muted); font-size: 13px; }

.tp-rate { display: inline-flex; align-items: center; gap: 2px; }
.tp-rate .ic { width: 14px; height: 14px; }
.tp-ex { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tp-exb {
  display: grid; justify-items: center; gap: 2px; padding: 10px 4px; border: 1px solid var(--line-2); border-radius: 12px;
  font-weight: 600; font-size: 15px; transition: background-color 150ms ease, transform 120ms var(--ease-press);
}
.tp-exb > span { display: inline-flex; align-items: center; gap: 3px; }
.tp-exb .ic { width: 14px; height: 14px; color: var(--muted); }
.tp-exb .tp-to { color: var(--muted); font-size: 13px; font-weight: 500; }
.tp-exb:active { transform: scale(.97); background: var(--raise-2); }
.tp-exb:disabled { opacity: .4; }
.tp-daily { gap: 12px; }
.modal .tp-daily { background: var(--raise-2); }

.tp-sum { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; }
.tp-provs .tp-prov { gap: 12px; }
.modal .tp-provs { background: var(--raise-2); }
.tp-prov-ic { font: 600 18px/1 var(--font-display); }
.tp-prov .tp-price { font-size: 14px; flex-direction: column; align-items: flex-end; gap: 0; }
.tp-off-note { margin: 0; }

.tp-wait { display: grid; justify-items: center; gap: 8px; padding: 20px 0 24px; text-align: center; }
.tp-order { color: var(--muted); font-size: 13px; margin: 0; }
.tp-dots { display: inline-flex; gap: 6px; margin-top: 6px; }
.tp-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: tp-dot 1.2s var(--ease-out) infinite; }
.tp-dots i:nth-child(2) { animation-delay: .15s; }
.tp-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tp-dot { 0%, 100% { opacity: .25; } 40% { opacity: 1; } }
.tp-wait + .btn, .tp-wait ~ .btn { margin-top: 8px; }
.tp-done { display: grid; justify-items: center; gap: 10px; padding: 12px 0 20px; text-align: center; }
.tp-done-ic { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--raise-2); animation: tp-pop 280ms var(--ease-enter) backwards; }
.tp-done-ic .ic { width: 32px; height: 32px; }
.tp-done .tp-bal { margin: 0; }
@keyframes tp-pop { from { opacity: 0; transform: scale(.8); } }

/* ── вход в гардероб на главной и в профиле ── */
.wd-entry { margin-top: 12px; }
.me-card + .wd-entry { margin-top: 12px; }

/* ── итоги (street.js → stageSprites): поклон один раз и держит последний кадр; поклон кадрами — без наклона сцены ── */
.end-strip.is-hold { animation: spr-play var(--d) steps(var(--n)) var(--dl, 0ms) var(--it, 1) both; }
.end-fig.is-bow.is-bowspr .end-bow { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .wd-strip, .wd-fig, .tp-dots i, .tp-done-ic { animation: none; }
  .tp-dots i { opacity: .7; }
  .end-strip.is-hold { animation: none !important; }
}
