:root {
  --bg: #000;
  --card: rgba(255, 255, 255, .045);
  --card-2: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .09);
  --text: #f5f5f7;
  --muted: rgba(245, 245, 247, .52);
  --gold: #ffc94d;
  --red: #ff6b6b;
  --green: #4ade80;
  --r: 20px;
  --top: max(env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px) + var(--tg-safe-area-inset-top, 0px));
  --bottom: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px));
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; }

/* ---------- живой фон ---------- */
.bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.bg i {
  position: absolute; width: 90vmax; height: 90vmax; border-radius: 50%;
  opacity: .5; will-change: transform;
}
.b1 { background: radial-gradient(circle, rgba(124, 58, 237, .55), transparent 60%); top: -45vmax; left: -40vmax; animation: d1 26s ease-in-out infinite alternate; }
.b2 { background: radial-gradient(circle, rgba(236, 72, 153, .42), transparent 60%); top: 10vh; right: -55vmax; animation: d2 31s ease-in-out infinite alternate; }
.b3 { background: radial-gradient(circle, rgba(14, 165, 233, .38), transparent 60%); bottom: -55vmax; left: -20vmax; animation: d3 36s ease-in-out infinite alternate; }
.b4 { background: radial-gradient(circle, rgba(16, 185, 129, .22), transparent 60%); top: 30vh; left: 10vw; animation: d4 42s ease-in-out infinite alternate; }
@keyframes d1 { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(35vw, 25vh) scale(1.15); } 100% { transform: translate(10vw, 55vh) scale(.9); } }
@keyframes d2 { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-40vw, 30vh) scale(1.2); } 100% { transform: translate(-15vw, -20vh) scale(.95); } }
@keyframes d3 { 0% { transform: translate(0, 0) scale(1.1); } 50% { transform: translate(30vw, -35vh) scale(.9); } 100% { transform: translate(-10vw, -10vh) scale(1.2); } }
@keyframes d4 { 0% { transform: translate(0, 0) scale(.8); } 50% { transform: translate(-30vw, -25vh) scale(1.1); } 100% { transform: translate(25vw, 20vh) scale(.9); } }
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-reduced-motion: reduce) { .bg i, .brand { animation: none !important; } }

/* ---------- шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--top) + 14px) 16px 12px;
  background: linear-gradient(#000 30%, rgba(0, 0, 0, 0));
}
.brand {
  font-family: Unbounded, Inter, sans-serif; font-weight: 800; font-size: 21px; letter-spacing: -.02em;
  background: linear-gradient(90deg, #ff5f9e, #b18cff, #5cc8ff, #4ef0b0, #ffd36b, #ff5f9e);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 7s linear infinite;
  filter: drop-shadow(0 0 18px rgba(177, 140, 255, .25));
}
@keyframes shimmer { to { background-position: -200% 0; } }
.cart-pill {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  border-radius: 999px; background: var(--card-2); border: 1px solid var(--line);
  font-weight: 600; font-size: 14px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.cart-pill svg { width: 18px; height: 18px; }
.cart-pill .n { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #fff; color: #000; font-size: 11px; display: grid; place-items: center; }

main { position: relative; z-index: 1; padding: 0 16px calc(var(--bottom) + 110px); }

/* ---------- нижние табы ---------- */
.tabs {
  position: fixed; z-index: 30; left: 12px; right: 12px; bottom: calc(var(--bottom) + 12px);
  display: flex; padding: 6px; gap: 4px; border-radius: 24px;
  background: rgba(18, 18, 20, .62); border: 1px solid var(--line);
  backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4);
  max-width: 520px; margin: 0 auto;
}
.tabs button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px; border-radius: 18px; font-size: 11px; font-weight: 500; color: var(--muted);
  transition: background .2s, color .2s;
}
.tabs button svg { width: 22px; height: 22px; }
.tabs button.on { color: #fff; background: var(--card-2); }
.tabs .dot { position: relative; }
.tabs .dot b { position: absolute; top: -4px; right: -9px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #fff; color: #000; font-size: 10px; display: grid; place-items: center; }

/* ---------- общие элементы ---------- */
h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.02em; margin: 6px 0 4px; font-weight: 700; }
h2 { font-size: 17px; margin: 22px 0 10px; font-weight: 600; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.fade-in { animation: fade .35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.star { width: 1em; height: 1em; color: var(--gold); vertical-align: -.12em; }
.price { font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }

.glass {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; width: 100%; border-radius: 16px; font-weight: 600; font-size: 15px;
  background: #fff; color: #000; transition: transform .12s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn.ghost { background: var(--card-2); color: #fff; border: 1px solid var(--line); }
.btn.danger { background: rgba(255, 107, 107, .1); color: var(--red); border: 1px solid rgba(255, 107, 107, .2); }
.btn.sm { height: 40px; border-radius: 12px; font-size: 14px; width: auto; padding: 0 14px; }
.btns { display: flex; gap: 10px; }
.btns > * { flex: 1; }

.icon-btn { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--card-2); border: 1px solid var(--line); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- витрина ---------- */
.hero { border-radius: 24px; overflow: hidden; margin: 4px 0 6px; position: relative; aspect-ratio: 16 / 9; background: #0a0a0a; border: 1px solid var(--line); }
.hero img, .hero video { width: 100%; height: 100%; object-fit: cover; display: block; }
.greet { margin: 8px 0 2px; }
.greet p { margin: 0; color: var(--muted); white-space: pre-line; font-size: 14px; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 16px -16px 14px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px 0 6px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font-weight: 500; font-size: 14px; transition: all .2s;
}
.chip .ic {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .07); font-size: 15px; line-height: 1;
}
.chip.on { background: #fff; color: #000; border-color: #fff; }
.chip.on .ic { background: rgba(0, 0, 0, .08); }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.card { overflow: hidden; display: flex; flex-direction: column; text-align: left; }
.card:active { transform: scale(.985); }
.card { transition: transform .15s; }
.thumb { aspect-ratio: 1; position: relative; background: rgba(255, 255, 255, .03); display: grid; place-items: center; overflow: hidden; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.ph { font-size: 44px; line-height: 1; opacity: .9; filter: drop-shadow(0 6px 24px rgba(177, 140, 255, .35)); }
.ph-ring {
  width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .12), rgba(255, 255, 255, .02));
  border: 1px solid var(--line);
}
.card .body { padding: 10px 12px 12px; }
.card .name { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.card .meta { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--card-2); color: var(--muted); }
.badge.out { color: var(--red); background: rgba(255, 107, 107, .1); }
.soldout { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); display: grid; place-items: center; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-size: 42px; margin-bottom: 10px; opacity: .8; }

/* ---------- корзина / заказы ---------- */
.line { display: flex; align-items: center; gap: 12px; padding: 12px; }
.line .mini { width: 54px; height: 54px; border-radius: 14px; overflow: hidden; flex: none; background: var(--card-2); display: grid; place-items: center; font-size: 22px; }
.line .mini img, .line .mini video { width: 100%; height: 100%; object-fit: cover; }
.line .info { flex: 1; min-width: 0; }
.line .info .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper { display: flex; align-items: center; background: var(--card-2); border-radius: 12px; border: 1px solid var(--line); }
.stepper button { width: 34px; height: 34px; display: grid; place-items: center; font-size: 18px; }
.stepper span { min-width: 22px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.total { display: flex; justify-content: space-between; align-items: center; padding: 16px 4px; font-size: 17px; }

.order { padding: 14px; }
.order + .order { margin-top: 10px; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; font-weight: 500; white-space: nowrap; }
.pill.done { background: rgba(74, 222, 128, .12); color: var(--green); }
.pill.paid { background: rgba(255, 201, 77, .12); color: var(--gold); }
.pill.refunded, .pill.pending { background: var(--card-2); color: var(--muted); }
.order .it { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-top: 8px; }
.secret {
  margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06);
  font: 13px/1.5 ui-monospace, "SF Mono", Menlo, monospace; white-space: pre-wrap; word-break: break-all;
  position: relative; padding-right: 44px;
}
.secret .copy { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--card-2); }
.secret .copy svg { width: 15px; height: 15px; }

/* ---------- sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); opacity: 0; transition: opacity .25s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto;
  background: #0b0b0d; border-top: 1px solid var(--line); border-radius: 26px 26px 0 0;
  padding: 10px 16px calc(var(--bottom) + 20px);
  transform: translateY(100%); transition: transform .32s cubic-bezier(.2, .8, .2, 1);
  max-width: 640px; margin: 0 auto; overscroll-behavior: contain;
}
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .18); margin: 0 auto 12px; }
.sheet-wrap.open { pointer-events: auto; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet .media { border-radius: 20px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--card); display: grid; place-items: center; margin-bottom: 14px; }
.sheet .media img, .sheet .media video { width: 100%; height: 100%; object-fit: cover; }
.sheet .desc { color: var(--muted); white-space: pre-line; margin: 8px 0 16px; }
.sheet h1 { font-size: 22px; }

/* ---------- формы ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 500; }
.input {
  width: 100%; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: #fff;
  border-radius: 14px; padding: 13px 14px; font-size: 16px; outline: none; transition: border-color .2s;
}
.input:focus { border-color: rgba(255, 255, 255, .3); }
textarea.input { min-height: 90px; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #888 50%), linear-gradient(135deg, #888 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.seg { display: flex; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 9px 6px; border-radius: 10px; font-size: 13px; font-weight: 500; color: var(--muted); }
.seg button.on { background: #fff; color: #000; }
.switch { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); margin-bottom: 14px; }
.tog { width: 46px; height: 28px; border-radius: 14px; background: rgba(255, 255, 255, .15); position: relative; transition: background .2s; flex: none; }
.tog::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.tog.on { background: var(--green); }
.tog.on::after { transform: translateX(18px); }

.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-bottom: 8px; }
.emoji-grid button { aspect-ratio: 1; border-radius: 12px; font-size: 19px; background: rgba(255, 255, 255, .04); border: 1px solid transparent; }
.emoji-grid button.on { border-color: #fff; background: rgba(255, 255, 255, .12); }

.mslot { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 16px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.mslot .pv { width: 72px; height: 72px; border-radius: 12px; overflow: hidden; background: rgba(255, 255, 255, .05); flex: none; display: grid; place-items: center; color: var(--muted); font-size: 11px; text-align: center; }
.mslot .pv img, .mslot .pv video { width: 100%; height: 100%; object-fit: cover; }
.mslot .grow { flex: 1; min-width: 0; }
.mslot .t { font-weight: 600; font-size: 14px; }

/* ---------- админка ---------- */
.subtabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 8px -16px 16px; padding: 0 16px; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.subtabs button.on { background: #fff; color: #000; border-color: #fff; }
.alist > * + * { margin-top: 8px; }
.aitem { display: flex; align-items: center; gap: 12px; padding: 10px 12px; width: 100%; text-align: left; }
.aitem .em { width: 42px; height: 42px; border-radius: 13px; background: var(--card-2); display: grid; place-items: center; font-size: 19px; flex: none; overflow: hidden; }
.aitem .em img, .aitem .em video { width: 100%; height: 100%; object-fit: cover; }
.aitem .grow { flex: 1; min-width: 0; }
.aitem .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aitem .s { font-size: 12px; color: var(--muted); }
.aitem.off { opacity: .45; }
.chev { color: var(--muted); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { padding: 16px; }
.tile .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; display: flex; align-items: center; gap: 6px; }
.tile .l { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- прочее ---------- */
.toast {
  position: fixed; z-index: 60; left: 50%; top: calc(var(--top) + 16px); transform: translate(-50%, -20px);
  background: rgba(30, 30, 34, .92); border: 1px solid var(--line); color: #fff; padding: 10px 16px;
  border-radius: 14px; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none;
  transition: all .25s; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 107, 107, .35); }
.loader { display: grid; place-items: center; padding: 120px 0; }
.loader span { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .15); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.gate { text-align: center; padding: 100px 24px; }
.gate .brand { display: inline-block; font-size: 34px; margin-bottom: 14px; }

@media (min-width: 640px) {
  main { max-width: 640px; margin: 0 auto; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .top { max-width: 640px; margin: 0 auto; }
}
