:root {
  --bg: var(--tg-theme-bg-color, #fff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f2f5);
  --text: var(--tg-theme-text-color, #111);
  --hint: var(--tg-theme-hint-color, #8a8a8f);
  --link: var(--tg-theme-link-color, #2a7de1);
  --btn: var(--tg-theme-button-color, #2a7de1);
  --btn-text: var(--tg-theme-button-text-color, #fff);
  --gold: #f5a623;
  --danger: #e5484d;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font: 15px/1.35 -apple-system, system-ui, Roboto, sans-serif; background: var(--bg2); color: var(--text); }
main { padding: 10px 10px 84px; }
h2 { margin: 6px 4px 12px; font-size: 20px; }
h3 { margin: 18px 4px 8px; font-size: 16px; }
input, textarea, select {
  width: 100%; padding: 11px 12px; border: 0; border-radius: 10px; background: var(--bg); color: var(--text);
  font: inherit; outline: none; margin-bottom: 10px;
}
textarea { min-height: 110px; resize: vertical; }
label { display: block; margin: 0 4px 4px; color: var(--hint); font-size: 13px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.btn {
  display: block; width: 100%; padding: 13px; border: 0; border-radius: 12px; font: 600 15px inherit;
  background: var(--btn); color: var(--btn-text); margin: 8px 0; cursor: pointer;
}
.btn.ghost { background: var(--bg); color: var(--link); }
.btn.danger { background: var(--bg); color: var(--danger); }
.btn.gold { background: var(--gold); color: #fff; }
.btn:disabled { opacity: .5; }
.search { position: sticky; top: 0; z-index: 2; background: var(--bg2); padding: 6px 0; margin-top: -6px; transition: transform .25s; }
.search.hide { transform: translateY(-100%); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 12px; border-radius: 16px; background: var(--bg); color: var(--text); border: 0; font: inherit; font-size: 13px; }
.chip.on { background: var(--btn); color: var(--btn-text); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card { background: var(--bg); border-radius: 12px; overflow: hidden; position: relative; }
.card .ph { aspect-ratio: 1; background: var(--bg2) center/cover no-repeat; display: flex; align-items: center; justify-content: center; font-size: 34px; color: var(--hint); }
.card .info { padding: 7px 9px 9px; }
.card .price { font-weight: 700; }
.card .title { font-size: 13px; margin: 2px 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card .city { font-size: 12px; color: var(--hint); }
.card.promo { box-shadow: 0 0 0 2px var(--gold); }
.badge { position: absolute; top: 6px; left: 6px; background: var(--gold); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 8px; }
.badge.gray { background: #0008; }
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 4px; border-radius: 12px; margin-bottom: 10px; }
.gallery img { flex: none; width: 100%; aspect-ratio: 1; object-fit: cover; scroll-snap-align: center; background: var(--bg); }
.box { background: var(--bg); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.big { font-size: 22px; font-weight: 700; }
.hint { color: var(--hint); font-size: 13px; }
.descr { white-space: pre-wrap; word-break: break-word; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.thumbs div { width: 70px; height: 70px; border-radius: 10px; background: var(--bg) center/cover; position: relative; }
.thumbs div b { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff; border-radius: 50%; width: 20px; height: 20px; font-size: 13px; text-align: center; line-height: 20px; }
.thumbs label { width: 70px; height: 70px; margin: 0; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--link); }
.list .item { display: flex; gap: 10px; background: var(--bg); border-radius: 12px; padding: 8px; margin-bottom: 8px; align-items: center; }
.list .item .ph { width: 64px; height: 64px; flex: none; border-radius: 8px; background: var(--bg2) center/cover; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.list .item .t { flex: 1; min-width: 0; }
.list .item .t div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch { display: flex; justify-content: space-between; align-items: center; }
.switch input { width: auto; margin: 0; transform: scale(1.3); }
.empty { text-align: center; color: var(--hint); padding: 50px 20px; }
nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--bg); border-top: 1px solid #8882; padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
nav button { flex: 1; border: 0; background: none; color: var(--hint); font: 12px inherit; display: flex; flex-direction: column; align-items: center; gap: 2px; }
nav button span { font-size: 20px; }
nav button.on { color: var(--btn); }
.old { text-decoration: line-through; color: var(--hint); font-weight: 400; font-size: .85em; margin-left: 4px; }
.badge.sale { background: var(--danger); left: auto; right: 6px; }
.badge.free { background: #2fb36d; }
.phwrap { position: relative; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; aspect-ratio: 1; scrollbar-width: none; }
.slides::-webkit-scrollbar { display: none; }
.slides div { flex: none; width: 100%; height: 100%; scroll-snap-align: start; background: var(--bg2) center/cover no-repeat; }
.dots { position: absolute; bottom: 7px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; pointer-events: none; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: #fff8; }
.dots i.on { background: #fff; }
.like { position: absolute; bottom: 6px; right: 6px; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: #0006; font-size: 17px; line-height: 34px; padding: 0; transition: transform .15s; }
.like.pop { transform: scale(1.3); }
.chip.free { font-weight: 600; }
.disc { display: flex; gap: 6px; flex-wrap: wrap; }
.disc button { flex: 1; min-width: 60px; padding: 10px 0; border: 0; border-radius: 10px; background: var(--danger); color: #fff; font: 600 15px inherit; }
.check { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 10px; padding: 11px 12px; margin-bottom: 10px; }
.check input { width: auto; margin: 0; transform: scale(1.3); }
select.lang { flex: 0 0 86px; font-weight: 600; }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #000c; color: #fff; padding: 9px 16px; border-radius: 18px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 9; max-width: 90%; text-align: center; }
#toast.show { opacity: 1; }

.ph img, .slides img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .ph { overflow: hidden; }
.list .item .ph { overflow: hidden; }
.link { color: var(--link); margin: -4px 4px 12px; cursor: pointer; }
.profile { display: flex; align-items: center; gap: 12px; }
.ava { width: 52px; height: 52px; border-radius: 50%; background: var(--btn); color: var(--btn-text); display: flex;
  align-items: center; justify-content: center; font-size: 22px; font-weight: 700; flex: none; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.stats div { background: var(--bg); border-radius: 12px; padding: 8px 4px; text-align: center; }
.stats b { display: block; font-size: 17px; }
.stats span { font-size: 11px; color: var(--hint); }
.menu { background: var(--bg); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.mitem { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid #8881; cursor: pointer; }
.mitem:last-child { border-bottom: 0; }
.mitem:active { background: var(--bg2); }
.mi { font-size: 19px; width: 24px; text-align: center; }
.mt { flex: 1; }
.mx { color: var(--hint); font-size: 14px; }
.mitem select.lang { margin: 0; padding: 6px 8px; background: var(--bg2); }

.card.hl { box-shadow: 0 0 0 2px var(--gold); }
.card.xl { grid-column: 1 / -1; }
.card.xl .ph, .card.xl .slides { aspect-ratio: 16 / 10; }
.badge.urgent { background: #ff5a36; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tags span { background: var(--bg2); border-radius: 8px; padding: 3px 8px; font-size: 12px; }
.tags .gold { color: var(--gold); font-weight: 600; }
.pro { background: var(--gold); color: #fff; border-radius: 6px; padding: 1px 6px; font-size: 11px; font-weight: 700; margin-left: 6px; }
.pack ul, .box ul { margin: 6px 0; padding-left: 18px; }
.pack.best { box-shadow: 0 0 0 2px var(--gold); }
.stars { display: flex; justify-content: center; gap: 10px; font-size: 40px; color: #8885; margin: 10px 0 14px; }
.stars span.on { color: var(--gold); }
.fbtn { flex: 0 0 52px; border: 0; border-radius: 10px; background: var(--bg); color: var(--text); font: 600 15px inherit; margin-bottom: 10px; }
.fbtn.on { background: var(--btn); color: var(--btn-text); }
.panel { display: none; background: var(--bg2); padding-top: 2px; }
.panel.open { display: block; }
.mitem input[type=checkbox] { width: auto; margin: 0; transform: scale(1.3); }

.gallery img { cursor: zoom-in; }
.viewer { position: fixed; inset: 0; background: #000; z-index: 50; overflow: hidden; touch-action: none; }
.viewer.anim { transition: background .2s; }
.vtrack { display: flex; height: 100%; will-change: transform; }
.vtrack.anim { transition: transform .22s cubic-bezier(.2,.8,.2,1); }
.vcell { flex: none; width: 100vw; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.vcell img { max-width: 100%; max-height: 100%; object-fit: contain; will-change: transform; user-select: none; -webkit-user-drag: none; }
.vcell img.anim { transition: transform .25s cubic-bezier(.2,.8,.2,1); }
.vcount { position: absolute; top: 14px; left: 0; right: 0; text-align: center; color: #fff; font-size: 14px; pointer-events: none; }
.vclose { position: absolute; top: 8px; right: 10px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #fff3; color: #fff; font-size: 18px; }
