/* Тёмная тема в цветах аватарки бота: ночной Studio, синяя рамка выделения, подсветка Luau */
:root {
  --bg: #0b0e15;
  --bg-2: #101a2e;
  --text: #edf1f7;
  --muted: rgba(225, 232, 243, .56);
  --faint: rgba(225, 232, 243, .32);
  --accent: #1e9bff;
  --accent-soft: rgba(30, 155, 255, .16);
  --gold: #f5b83d;
  --ok: #4fd98b;
  --danger: #ff6b7a;

  --glass: rgba(255, 255, 255, .065);
  --glass-strong: rgba(22, 28, 42, .62);
  --stroke: rgba(255, 255, 255, .12);
  --stroke-bright: rgba(255, 255, 255, .22);
  --shine: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -1px 0 rgba(255, 255, 255, .03);

  /* подсветка синтаксиса Studio — ею же окрашены категории */
  --c-script: #f86d7c;
  --c-game: #84d6f7;
  --c-model: #fdfbac;
  --c-asset: #adf195;
  --c-service: #c9a2ff;

  --sc: "Alegreya Sans SC", "Onest", system-ui, sans-serif;
  --sans: "Onest", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", Consolas, "SF Mono", monospace;

  --r-lg: 24px;
  --r-md: 18px;
  --tabbar-h: 64px;
  --safe-bottom: var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --safe-top: var(--tg-content-safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
button:disabled { opacity: .5; cursor: default; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.sc { font-family: var(--sc); letter-spacing: .04em; }

/* ---------- фон: свечение + сетка baseplate */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%); }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.blob-a { width: 320px; height: 320px; top: -90px; left: -60px; background: #0f6fd6; }
.blob-b { width: 280px; height: 280px; bottom: 8%; right: -110px; background: #5b3fd1; opacity: .35; }
.baseplate {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 70%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 70%);
}

/* ---------- стекло */
.glass {
  background: linear-gradient(160deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .04));
  border: 1px solid var(--stroke);
  box-shadow: var(--shine), 0 12px 32px rgba(0, 0, 0, .35);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
}

/* ---------- шапка */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: calc(16px + var(--safe-top)) 18px 8px;
}
.avatar {
  width: 46px; height: 46px; border-radius: 15px; flex: none; object-fit: cover;
  box-shadow: 0 0 0 1px var(--stroke-bright), 0 6px 18px rgba(30, 155, 255, .25);
}
.brand { min-width: 0; flex: 1; }
.brand-name { font-family: var(--sc); font-weight: 800; font-size: 22px; line-height: 1.05; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 3px; letter-spacing: .02em; }
.hello { font-family: var(--sc); font-size: 14px; color: var(--muted); white-space: nowrap; }
/* переход между магазином и админ-панелью внутри одного окна */
.top-link {
  flex: none; height: 34px; padding: 0 14px 0 11px; border-radius: 17px;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  font-family: var(--sc); font-weight: 700; font-size: 15px; letter-spacing: .04em; color: var(--text);
  background: var(--glass); border: 1px solid var(--stroke-bright); box-shadow: var(--shine);
}
.top-link[hidden] { display: none; }
.top-link:active { background: var(--accent-soft); }
.top-link svg { width: 16px; height: 16px; }
.top-link.icon-only { width: 34px; padding: 0; justify-content: center; }
/* звёзды на балансе магазина */
.balance-pill {
  flex: none; height: 34px; padding: 0 13px 0 9px; border-radius: 17px;
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums;
  background: rgba(245, 184, 61, .1); border: 1px solid rgba(245, 184, 61, .35); box-shadow: var(--shine);
  transition: transform .12s;
}
.balance-pill .star { width: 18px; height: 18px; }
.balance-pill:active { transform: scale(.95); }

/* ---------- основная область */
#view { padding: 6px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 40px); min-height: 60vh; }
body.has-fallback #view { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 104px); }

.loader { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 70px 0; font-family: var(--sc); font-size: 16px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--stroke); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.search-wrap { position: relative; display: block; border-radius: 16px; }
.search-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.search {
  width: 100%; height: 46px; padding: 0 16px 0 42px; border-radius: 16px;
  border: 0; outline: none; background: transparent; color: var(--text); font: inherit;
}
.search::placeholder { color: var(--faint); }
.search-wrap:focus-within { border-color: rgba(30, 155, 255, .5); }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: 14px -16px 16px; padding: 2px 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
/* если категории не влезают, край строки затухает — видно, что дальше есть ещё */
.chips.more-right { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent); }
.chips.more-left { -webkit-mask-image: linear-gradient(90deg, transparent, #000 44px); mask-image: linear-gradient(90deg, transparent, #000 44px); }
.chips.more-left.more-right {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 44px, #000 calc(100% - 44px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 44px, #000 calc(100% - 44px), transparent);
}
/* с мышью (Telegram Desktop) свайпа нет, поэтому показываем тонкую полосу прокрутки */
@media (hover: hover) and (pointer: fine) {
  .chips { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .22) transparent; padding-bottom: 8px; margin-bottom: 8px; }
  .chips::-webkit-scrollbar { display: block; height: 6px; }
  .chips::-webkit-scrollbar-track { background: transparent; }
  .chips::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border-radius: 3px; }
  .chips::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .36); }
}
.chip {
  flex: none; height: 34px; padding: 0 15px; border-radius: 17px;
  font-family: var(--sc); font-weight: 700; font-size: 15px; letter-spacing: .04em; color: var(--muted);
  background: var(--glass); border: 1px solid var(--stroke); box-shadow: var(--shine);
  display: inline-flex; align-items: center; gap: 7px; transition: color .15s, background .15s, border-color .15s;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.chip.active { color: #fff; background: var(--accent-soft); border-color: rgba(30, 155, 255, .55); box-shadow: var(--shine), 0 0 18px rgba(30, 155, 255, .25); }

/* ---------- карточки */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.card {
  display: flex; flex-direction: column; padding: 6px; border-radius: var(--r-lg); cursor: pointer;
  background: linear-gradient(165deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .025));
  border: 1px solid var(--stroke); box-shadow: var(--shine), 0 14px 30px rgba(0, 0, 0, .3);
  transition: transform .14s ease;
}
.card:active { transform: scale(.975); }

.thumb { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-md); overflow: hidden; background: #171b24; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb.ph { border: 1px solid rgba(255, 255, 255, .06); }
.code-lines { position: absolute; inset: 14px 14px auto 12px; display: flex; flex-direction: column; gap: 7px; opacity: .55; }
.code-line { display: flex; gap: 5px; height: 5px; }
.code-line i { display: block; height: 5px; border-radius: 3px; }
.ext {
  position: absolute; left: 12px; bottom: 10px;
  font-family: var(--mono); font-weight: 700; font-size: 22px; color: var(--c); letter-spacing: -.01em;
  text-shadow: 0 0 18px color-mix(in srgb, var(--c) 45%, transparent);
}
.thumb.small { width: 54px; height: 54px; aspect-ratio: auto; border-radius: 14px; flex: none; }
.thumb.small .code-lines { inset: 9px 8px auto 8px; gap: 5px; }
.thumb.small .code-line, .thumb.small .code-line i { height: 3px; }
.thumb.small .ext { font-size: 12px; left: 7px; bottom: 5px; }
.thumb.hero { aspect-ratio: 16 / 10; border-radius: 20px; }
.thumb.hero .ext { font-size: 34px; left: 18px; bottom: 14px; }
.thumb.hero .code-lines { inset: 22px 22px auto 20px; gap: 10px; }
.thumb.hero .code-line, .thumb.hero .code-line i { height: 7px; }

.card-body { padding: 10px 8px 6px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.card-cat { font-family: var(--sc); font-weight: 700; font-size: 13.5px; letter-spacing: .05em; color: var(--c, var(--muted)); }
.card-title { font-weight: 600; line-height: 1.28; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }

.price { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 16px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.price.free { font-family: var(--sc); font-size: 15.5px; color: var(--ok); letter-spacing: .04em; }

/* звезда — своим SVG, чтобы цены выглядели одинаково на любой системе */
.star { width: 15px; height: 15px; flex: none; fill: var(--gold); stroke: none; filter: drop-shadow(0 0 6px rgba(245, 184, 61, .45)); }

.round-btn {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--glass); border: 1px solid var(--stroke-bright); box-shadow: var(--shine);
  transition: transform .12s, background .15s;
}
.round-btn svg { width: 18px; height: 18px; stroke-width: 2.2; }
.round-btn:active { transform: scale(.88); }
.round-btn.on { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 0 16px rgba(30, 155, 255, .45); }

.round-btn.get { color: var(--ok); background: rgba(79, 217, 139, .12); border-color: rgba(79, 217, 139, .4); }
.owned { display: inline-flex; align-items: center; gap: 4px; font-family: var(--sc); font-weight: 700; font-size: 14px; letter-spacing: .04em; color: var(--muted); }
.owned svg { width: 15px; height: 15px; color: var(--ok); stroke-width: 2.4; }

/* ---------- рекламные баннеры вверху каталога */
.promos { margin-bottom: 14px; }
.promo-strip {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; border-radius: var(--r-lg);
}
.promo-strip::-webkit-scrollbar { display: none; }
.promo {
  position: relative; isolation: isolate; flex: 0 0 100%; width: 100%; min-width: 0;
  aspect-ratio: 11 / 5; min-height: 150px; max-height: 220px;
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; overflow: hidden;
  border-radius: var(--r-lg); border: 1px solid var(--stroke); box-shadow: var(--shine);
  scroll-snap-align: start; scroll-snap-stop: always;
  color: #fff; text-align: left; background: var(--promo);
  transition: opacity .12s;
}
button.promo:active { opacity: .86; }
.promo::before { content: ""; position: absolute; z-index: -2; right: -50px; top: -70px; width: 210px; height: 210px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .2), transparent 70%); }
.promo.has-image { background: #171b24; }  /* цветной фон не должен просвечивать ободком вокруг картинки */
.promo.has-image::before { display: none; }
.promo > svg { opacity: .75; }
.c-blue { --promo: linear-gradient(135deg, #1270d4, #0a3474); }
.c-violet { --promo: linear-gradient(135deg, #6a3fd8, #2f1872); }
.c-gold { --promo: linear-gradient(135deg, #a26a08, #573404); }
.c-green { --promo: linear-gradient(135deg, #12845a, #08442d); }
.c-red { --promo: linear-gradient(135deg, #c5344a, #641222); }
.c-dark { --promo: linear-gradient(135deg, #262e42, #10141e); }
.promo-img { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* на картинке текст читается только поверх затемнения; картинка без текста остаётся чистой */
.promo.has-image.has-copy::after { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, rgba(8, 11, 18, .82), rgba(8, 11, 18, .45) 60%, rgba(8, 11, 18, .1)); }
.promo-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.promo-title, .promo-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.promo-title { font-family: var(--sc); font-weight: 800; font-size: 21px; line-height: 1.1; letter-spacing: .02em; }
.promo-text { font-size: 13.5px; line-height: 1.3; color: rgba(255, 255, 255, .88); }
.promo-cta {
  margin-top: 6px; max-width: 100%; padding: 4px 13px; border-radius: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--sc); font-weight: 700; font-size: 14.5px; letter-spacing: .04em;
  background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .35);
}
.promo-foot { position: relative; min-height: 22px; margin-top: 6px; display: flex; justify-content: center; align-items: center; }
.promo-dots { display: flex; flex-wrap: wrap; justify-content: center; padding: 0 64px; }
.promo-dot { width: 22px; height: 22px; display: grid; place-items: center; }
.promo-dot::before { content: ""; width: 6px; height: 6px; border-radius: 3px; background: var(--faint); transition: width .2s, background .2s; }
.promo-dot.active::before { width: 16px; background: var(--accent); }
.promo-edit { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); font-size: 13.5px; text-decoration: none; }
.promo-add {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 50px; margin-bottom: 14px; border-radius: var(--r-md);
  border: 1px dashed var(--stroke-bright); color: var(--muted); text-decoration: none;
  font-family: var(--sc); font-weight: 700; font-size: 15px; letter-spacing: .04em;
}
.promo-add svg { width: 18px; height: 18px; }

/* ---------- баннер набора */
.recruit {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 18px; padding: 16px;
  border-radius: var(--r-lg); text-align: left; overflow: hidden;
}
.recruit::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.recruit-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.recruit-text b { font-family: var(--sc); font-size: 17px; letter-spacing: .03em; }
.recruit-text span { color: var(--muted); font-size: 13.5px; }
.recruit svg { color: var(--muted); }

/* ---------- пустые состояния */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-art {
  display: inline-block; margin-bottom: 14px; padding: 10px 16px; border-radius: 14px;
  font-family: var(--mono); font-size: 15px; color: var(--c-game); background: rgba(255, 255, 255, .04); border: 1px solid var(--stroke);
}
.empty-title { font-family: var(--sc); font-weight: 800; font-size: 21px; color: var(--text); margin-bottom: 4px; letter-spacing: .02em; }
.empty .btn { margin-top: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px; border-radius: 16px;
  font-family: var(--sc); font-weight: 800; font-size: 17px; letter-spacing: .04em;
  background: var(--accent); color: #fff; box-shadow: 0 8px 22px rgba(30, 155, 255, .35), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.btn.ghost { background: var(--glass); color: var(--text); border: 1px solid var(--stroke-bright); box-shadow: var(--shine); }
.btn.block { width: 100%; }

/* ---------- корзина */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 2px 14px; }
.section-title { font-family: var(--sc); font-weight: 800; font-size: 28px; letter-spacing: .02em; margin: 0; }
.section-sub { font-family: var(--sc); font-weight: 700; font-size: 15px; letter-spacing: .06em; color: var(--muted); margin: 22px 4px 8px; }
.panel { border-radius: var(--r-lg); overflow: hidden; background: var(--glass); border: 1px solid var(--stroke); box-shadow: var(--shine); }
.cart-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.cart-row + .cart-row { border-top: 1px solid var(--stroke); }
.cart-info { flex: 1; min-width: 0; cursor: pointer; }
.cart-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-info .card-cat { font-size: 13px; }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--faint); flex: none; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:active { background: var(--glass); }

.comment {
  width: 100%; min-height: 92px; resize: vertical; padding: 13px 15px; border-radius: var(--r-md);
  background: var(--glass); border: 1px solid var(--stroke); box-shadow: var(--shine);
  color: var(--text); font: inherit; outline: none;
}
.comment:focus { border-color: rgba(30, 155, 255, .5); }
.comment::placeholder { color: var(--faint); }
.total-row { display: flex; justify-content: space-between; align-items: center; padding: 15px 18px; margin-top: 16px; }
.total-row > span { font-family: var(--sc); font-size: 17px; letter-spacing: .04em; color: var(--muted); }
.total-row .price { font-size: 20px; }
.total-row .price .star { width: 18px; height: 18px; }
.hint { color: var(--muted); font-size: 13.5px; margin: 12px 4px 0; }

/* сколько спишется с баланса магазина и сколько останется оплатить звёздами Telegram */
.pay-split { margin-top: 10px; padding: 4px 0; }
.pay-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 18px; }
.pay-row > span:first-child { font-family: var(--sc); font-size: 15px; letter-spacing: .04em; color: var(--muted); }
.pay-row.from-balance .price { color: var(--ok); }

/* ---------- баланс звёзд в магазине */
.wallet { position: relative; overflow: hidden; padding: 18px 18px 16px; border-radius: var(--r-lg); }
.wallet::after { content: ""; position: absolute; right: -40px; top: -50px; width: 170px; height: 170px; border-radius: 50%; background: radial-gradient(circle, rgba(245, 184, 61, .3), transparent 70%); pointer-events: none; }
.wallet-label { font-family: var(--sc); font-weight: 700; font-size: 15px; letter-spacing: .05em; color: var(--muted); }
.wallet-value { display: flex; align-items: center; gap: 10px; margin-top: 2px; font-weight: 700; font-size: 38px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.wallet-value .star { width: 32px; height: 32px; filter: drop-shadow(0 0 12px rgba(245, 184, 61, .5)); }
.wallet-sub { margin-top: 6px; font-size: 13px; color: var(--faint); }

/* покупка звёзд на баланс */
.topup { padding: 14px; }
.packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pack {
  height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  font-weight: 700; font-size: 15.5px; font-variant-numeric: tabular-nums;
  background: rgba(245, 184, 61, .09); border: 1px solid rgba(245, 184, 61, .32); box-shadow: var(--shine);
  transition: transform .12s;
}
.pack:active { transform: scale(.96); }
.topup-custom { display: flex; gap: 8px; margin: 10px 0; }
.topup-input {
  flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: 14px; outline: none;
  background: var(--glass); border: 1px solid var(--stroke); color: var(--text); font: inherit;
}
.topup-input:focus { border-color: rgba(30, 155, 255, .5); }
.topup-input::placeholder { color: var(--faint); }

.log-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; }
.log-row + .log-row { border-top: 1px solid var(--stroke); }
.log-row-main { flex: 1; min-width: 0; }
.log-row-title { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.log-delta { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.log-delta.plus { color: var(--ok); }

/* ---------- покупки */
.link-btn { font-family: var(--sc); font-weight: 700; font-size: 15px; letter-spacing: .05em; color: var(--accent); }
.link-btn.danger { color: var(--danger); }
.order { border-radius: var(--r-lg); padding: 15px 16px; margin-bottom: 12px; background: var(--glass); border: 1px solid var(--stroke); box-shadow: var(--shine); }
.order-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.order-no { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.order-date { color: var(--faint); font-size: 13px; margin-top: 2px; }
.order-items { list-style: none; margin: 12px 0; padding: 10px 0; border-top: 1px dashed var(--stroke); border-bottom: 1px dashed var(--stroke); }
.order-items li { padding: 4px 0; }
.order-items li + li { margin-top: 4px; }
.order-item-row { display: flex; justify-content: space-between; gap: 12px; }
.order-items li .price { font-size: 14px; font-weight: 600; color: var(--muted); }
.order-items li .price .star { width: 13px; height: 13px; }
.order-item-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
.mini-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px 0 10px; border-radius: 12px;
  font-family: var(--sc); font-weight: 700; font-size: 15px; letter-spacing: .04em; color: #fff;
  background: var(--accent-soft); border: 1px solid rgba(30, 155, 255, .5); box-shadow: var(--shine);
}
.mini-btn svg { width: 16px; height: 16px; stroke-width: 2.2; }
.mini-btn:active { background: rgba(30, 155, 255, .32); }
.item-text { flex-basis: 100%; }
.item-text summary { cursor: pointer; font-size: 13.5px; color: var(--muted); }
.item-text .desc { margin-top: 8px; font-size: 13.5px; }
.order-foot { display: flex; justify-content: space-between; align-items: center; }
.order-foot > span { font-family: var(--sc); font-size: 16px; color: var(--muted); letter-spacing: .04em; }
.order .btn { margin-top: 14px; height: 42px; font-size: 16px; }
.order-note { margin-top: 10px; font-size: 13px; color: var(--muted); white-space: pre-wrap; word-break: break-word; }

.status { font-family: var(--sc); font-weight: 700; font-size: 13.5px; letter-spacing: .05em; padding: 3px 10px; border-radius: 10px; white-space: nowrap; color: var(--s); background: color-mix(in srgb, var(--s) 13%, transparent); border: 1px solid color-mix(in srgb, var(--s) 30%, transparent); }

/* ---------- поддержка */
.chat { display: flex; flex-direction: column; min-height: calc(100vh - 210px); }
.chat .section-head { margin-bottom: 8px; }
.chat .note { margin-top: 0; }
.chat-list { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 14px 0; }
.bubble { max-width: 84%; padding: 9px 13px 7px; border-radius: 18px; border: 1px solid var(--stroke); box-shadow: var(--shine); }
.bubble.me { align-self: flex-end; background: var(--accent-soft); border-color: rgba(30, 155, 255, .4); border-bottom-right-radius: 6px; }
.bubble.them { align-self: flex-start; background: var(--glass); border-bottom-left-radius: 6px; }
.bubble-who { font-family: var(--sc); font-weight: 700; font-size: 13.5px; letter-spacing: .04em; color: var(--accent); }
.bubble-file { font-size: 13px; color: var(--muted); }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-time { margin-top: 2px; font-size: 11.5px; color: var(--faint); text-align: right; }
.chat-compose {
  position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 18px); z-index: 10;
  display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 22px; background: var(--glass-strong);
}
.chat-input {
  flex: 1; min-width: 0; max-height: 130px; padding: 8px 0; border: 0; outline: none; resize: none;
  background: transparent; color: var(--text); font: inherit;
}
.chat-input::placeholder { color: var(--faint); }
.chat-send {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(30, 155, 255, .4);
}
.chat-send svg { width: 20px; height: 20px; stroke-width: 2.4; }
/* обращения покупателей: экран владельца и модераторов */
.support-switch { margin-top: 0; margin-bottom: 12px; }
.inbox .note { margin-top: 0; }
.inbox-list { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; }
.inbox-row {
  display: block; width: 100%; padding: 11px 13px; border-radius: 16px; text-align: left; cursor: pointer;
  background: var(--glass); border: 1px solid var(--stroke); box-shadow: var(--shine);
  transition: transform .14s ease;
}
.inbox-row:active { transform: scale(.985); }
.inbox-row.waiting { border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.inbox-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.inbox-name { min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-last {
  margin-top: 4px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.inbox-time { margin-top: 4px; font-size: 11.5px; color: var(--faint); }
.thread-back { align-self: flex-start; margin: 2px 2px 8px; }
.chat .thread-head { flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 0; }
.thread-head .section-title { font-size: 24px; overflow-wrap: anywhere; }
.thread-who { font-size: 13px; color: var(--muted); }
/* тикеты */
.ticket-new { margin-bottom: 12px; }
.ticket-new svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.tickets .note { margin-top: 0; }
.inbox-row.closed { opacity: .72; }
.ticket-meta { margin-top: 3px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.ticket-subject { margin-top: 4px; font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.ticket-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 2px 2px 10px; }
.ticket-info { min-width: 0; flex: 1; }
.ticket-info .ticket-subject { margin-top: 0; }
.ticket-actions { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.ticket-topics { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.ticket-order { display: block; min-height: 0; height: 48px; padding: 0 15px; resize: none; color-scheme: dark; }
.ticket-after { margin-bottom: 8px; }
.ticket-after svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.ticket-submit { margin-top: 16px; }
.ticket-submit:disabled { opacity: .6; }
/* на телефоне экранная клавиатура поднимает таббар — на время набора прячем его */
body.typing .tabbar { display: none; }
body.typing .chat-compose { bottom: calc(var(--safe-bottom) + 10px); }
body.typing #view { padding-bottom: 16px; }

/* ---------- таббар */
.tabbar {
  position: fixed; z-index: 20; left: 14px; right: 14px; bottom: calc(10px + var(--safe-bottom));
  height: var(--tabbar-h); padding: 6px; border-radius: 24px;
  display: flex; gap: 4px; background: var(--glass-strong);
}
.tab {
  flex: 1; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--faint); font-family: var(--sc); font-weight: 700; font-size: 13.5px; letter-spacing: .05em;
  transition: color .18s, background .18s;
}
.tab svg { width: 22px; height: 22px; }
@media (max-width: 400px) { .tab { font-size: 12.5px; letter-spacing: .03em; } }
.tab.active { color: #fff; background: rgba(30, 155, 255, .18); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); }
.tab.active svg { color: var(--accent); }
.tab-icon { position: relative; display: inline-flex; }
.badge {
  position: absolute; top: -6px; right: -11px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font: 700 11px/18px var(--sans); text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}

/* ---------- карточка товара (шторка) */
.sheet { position: fixed; inset: 0; z-index: 40; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(3, 6, 12, .55); opacity: 0; transition: opacity .25s; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92%; overflow-y: auto;
  padding: 10px 16px calc(28px + var(--safe-bottom)); border-radius: 28px 28px 0 0;
  background: linear-gradient(180deg, rgba(30, 37, 54, .82), rgba(14, 18, 28, .9));
  border-top: 1px solid var(--stroke-bright); box-shadow: 0 -20px 50px rgba(0, 0, 0, .5);
  backdrop-filter: blur(30px) saturate(160%); -webkit-backdrop-filter: blur(30px) saturate(160%);
  transform: translateY(100%); transition: transform .3s cubic-bezier(.2, .85, .25, 1);
}
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet.open .sheet-panel { transform: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--stroke-bright); margin: 0 auto 12px; }
.sheet-close { position: absolute; top: 18px; right: 18px; z-index: 2; width: 34px; height: 34px; }
.sheet-body { padding: 16px 4px 0; }
.sheet-title { font-family: var(--sc); font-weight: 800; font-size: 27px; line-height: 1.12; letter-spacing: .015em; margin: 4px 0 8px; }
.sheet-body .price { font-size: 22px; }
.sheet-body .price .star { width: 19px; height: 19px; }
.desc { white-space: pre-wrap; word-break: break-word; margin-top: 16px; line-height: 1.55; color: rgba(237, 241, 247, .86); }
.note { margin-top: 14px; padding: 11px 14px; border-radius: 14px; font-size: 14px; background: var(--glass); border: 1px solid var(--stroke); color: var(--muted); }
.note.ok { color: var(--ok); background: rgba(79, 217, 139, .08); border-color: rgba(79, 217, 139, .25); }
.note.warn { color: var(--gold); background: rgba(245, 184, 61, .08); border-color: rgba(245, 184, 61, .3); }
body.has-fallback .sheet-panel { padding-bottom: calc(92px + var(--safe-bottom)); }

/* ---------- кнопка действия вне Telegram */
.fallback-main {
  position: fixed; left: 16px; right: 16px; z-index: 50; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
  height: 52px; border-radius: 18px;
  font-family: var(--sc); font-weight: 800; font-size: 18px; letter-spacing: .04em;
  background: var(--accent); color: #fff; box-shadow: 0 10px 28px rgba(30, 155, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.sheet-open .fallback-main { bottom: calc(var(--safe-bottom) + 16px); }

/* ---------- уведомление */
.toast {
  position: fixed; left: 50%; top: calc(14px + var(--safe-top)); z-index: 60; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 16px;
  background: rgba(22, 28, 42, .78); font-size: 14px; text-align: center;
}
