:root {
  --bg: #0e0e10;
  --surface: #1a1a1d;
  --surface-2: #242428;
  --surface-3: #303036;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --muted: #9b9ba3;
  --dim: #6c6c74;
  --like: #ff375f;
  --ok: #30d158;
  --warn: #ffb340;
  --bad: #ff453a;
  --tg: #2aabee;
  --accent: #8b7bff;
  --accent-2: #ff6a88;
  --grad: linear-gradient(135deg, #ff6a88 0%, #c56bff 52%, #6a8bff 100%);
  --grad-soft: linear-gradient(135deg, rgba(255, 106, 136, .16), rgba(106, 139, 255, .16));
  --press: cubic-bezier(.2, .9, .3, 1);
  --r-xl: 22px;
  --r-lg: 18px;
  --r-md: 14px;
  --tabbar-h: 62px;
  /* В Telegram безопасные зоны отдаёт сам клиент (в полноэкранном режиме), в браузере — env() */
  --safe-t: max(env(safe-area-inset-top, 0px), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
/* Внутри Telegram: без выделения текста по долгому тапу и подсветки — ощущается как приложение */
.in-tg body { -webkit-user-select: none; user-select: none; overscroll-behavior: none; }
.in-tg input, .in-tg textarea, .in-tg .copy-block .v { -webkit-user-select: text; user-select: text; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(520px 360px at 105% -6%, rgba(197, 107, 255, .14), transparent 70%),
    radial-gradient(420px 320px at -12% 22%, rgba(255, 106, 136, .09), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.45 var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + 100px + var(--safe-b));
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
svg { flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- каркас ---------- */
.top, .app { width: 100%; max-width: 760px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: calc(12px + var(--safe-t)); padding-bottom: 6px; min-height: 62px;
}
.top h1 { font-size: 28px; line-height: 1.05; font-weight: 700; letter-spacing: -0.035em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.app { padding-top: 8px; }
.page-in { animation: pageIn .34s var(--press); }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } }
.wide { max-width: 1080px; }

h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.025em; margin: 0; }
h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head a { color: var(--muted); font-weight: 500; display: inline-flex; align-items: center; gap: 2px; }
.label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 20px 2px 9px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 48px; padding: 0 22px; border-radius: 999px; border: 0;
  background: var(--surface-2); color: var(--text);
  font-size: 16px; font-weight: 600; white-space: nowrap;
  transition: transform .18s var(--press), background .15s, opacity .15s, filter .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 6px 22px rgba(197, 107, 255, .28); }
.btn.primary:hover { background: var(--grad); filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.block { width: 100%; }
.btn.sm { height: 38px; padding: 0 16px; font-size: 14px; }
.btn.tg { background: var(--tg); color: #fff; }
.btn.tg:hover { background: #229ed9; }
.btn.danger { background: transparent; color: var(--bad); }
.btn.danger:hover { background: rgba(255, 69, 58, .1); }
.btn.ok { background: var(--ok); color: #04210d; }
.btn .sub { font-weight: 500; opacity: .5; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 0; flex: none;
  display: inline-grid; place-items: center; background: var(--surface-2); color: var(--text);
  transition: background .15s, transform .12s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { transform: scale(.9); }
.icon-btn.ghost { background: transparent; color: var(--muted); }
.icon-btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.light { background: #f2f2f4; color: #0e0e10; }
.icon-btn.sm { width: 36px; height: 36px; }
.icon-btn.liked { color: var(--like); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: 15px;
  transition: background .15s; white-space: nowrap;
}
.pill:hover { background: var(--surface-2); }
.pill .plus { width: 26px; height: 26px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; margin-right: -8px; }
.pill .plus svg { width: 16px; height: 16px; }
.pill > svg { color: var(--accent); width: 18px; height: 18px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; border: 0; padding: 0;
  background: var(--grad); display: grid; place-items: center; font-weight: 700; font-size: 16px; color: #fff;
}

/* ---------- поля ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 4px 8px; }
.input, .textarea {
  width: 100%; border: 1px solid transparent; outline: none; background: var(--surface); color: var(--text);
  border-radius: var(--r-md); padding: 12px 15px; font-size: 16px; transition: border-color .15s, background .15s, box-shadow .15s;
}
.input:focus, .textarea:focus { border-color: rgba(139, 123, 255, .6); box-shadow: 0 0 0 3px rgba(139, 123, 255, .15); }
.input::placeholder, .textarea::placeholder { color: var(--dim); }
.textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.search { position: relative; }
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { border-radius: 999px; padding-left: 48px; height: 46px; }

/* ---------- сегменты, чипы, переключатели ---------- */
.seg { display: flex; padding: 4px; border-radius: 999px; background: var(--surface); gap: 2px; }
.seg button {
  flex: 1; height: 38px; border: 0; border-radius: 999px; background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; padding: 0 12px;
  transition: background .15s, color .15s; min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.seg[data-tempo] button { padding: 0 4px; font-size: 14px; }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px rgba(139, 123, 255, .35); }
.seg button:active { transform: scale(.96); }

.chips { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, color .15s, transform .18s var(--press); white-space: nowrap;
}
.chip:hover { background: var(--surface-2); }
.chip:active { transform: scale(.93); }
.chip.on { background: var(--grad); color: #fff; border-color: transparent; font-weight: 600; }
.chip.pop { animation: pop .32s var(--press); }
@keyframes pop { 40% { transform: scale(1.1); } }
.chip .x { opacity: .6; }

.group { background: var(--surface); border-radius: var(--r-lg); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; min-height: 54px; }
.group > .row + .row { border-top: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 600; }
.row .s { color: var(--muted); font-size: 13px; margin-top: 1px; }
.row.link { cursor: pointer; transition: background .15s, transform .18s var(--press); width: 100%; border: 0; background: transparent; text-align: left; color: inherit; }
.row.link:hover { background: var(--surface-2); }
.row.link:active { transform: scale(.985); background: var(--surface-2); }
.row .ico { width: 36px; height: 36px; border-radius: 11px; color: var(--accent); background: var(--surface-3); display: grid; place-items: center; flex: none; overflow: hidden; }
.row .ico img { width: 100%; height: 100%; object-fit: cover; }
.row.on { background: var(--surface-2); }

.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background .2s; pointer-events: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }

.radio { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface-3); flex: none; display: grid; place-items: center; color: transparent; }
.on .radio { border-color: #f2f2f4; background: #f2f2f4; color: #0e0e10; }

/* ---------- композер ---------- */
.composer-box { background: var(--surface); border-radius: var(--r-xl); padding: 16px 16px 12px; transition: box-shadow .2s; }
.composer-box:focus-within { box-shadow: 0 0 0 1px rgba(139, 123, 255, .5), 0 0 0 4px rgba(139, 123, 255, .12); }
.composer-box .textarea { background: transparent; padding: 0; border: 0; min-height: 100px; font-size: 17px; resize: none; box-shadow: none; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.composer-foot .count { color: var(--dim); font-size: 15px; font-variant-numeric: tabular-nums; }
.create-wrap { margin-top: 28px; }
.create-wrap .btn { height: 52px; font-size: 16px; }
.create-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 12px; }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border-radius: var(--r-lg); background: rgba(255, 179, 64, .1); color: #ffd28a; margin-bottom: 14px; font-size: 14px; padding: 12px 14px; }

/* ---------- мастер создания ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.step { border: 0; background: none; padding: 0; color: var(--dim); font-size: 13px; font-weight: 600; text-align: left; display: grid; gap: 8px; }
.step i { display: block; height: 4px; border-radius: 2px; background: var(--surface-3); transition: background .2s; }
.step.done { color: var(--muted); }
.step.done i { background: var(--accent); opacity: .55; }
.step.on { color: var(--text); }
.step.on i { background: var(--grad); box-shadow: 0 0 10px rgba(197, 107, 255, .5); }
.step-count { color: var(--dim); font-size: 13px; margin: 14px 0 2px; }
.step-title { font-size: 23px; line-height: 1.15; letter-spacing: -0.03em; margin: 0; }
.step-sub { color: var(--muted); margin: 6px 0 0; font-size: 14px; }
.step-fwd { animation: stepFwd .32s var(--press); }
.step-back { animation: stepBack .32s var(--press); }
@keyframes stepFwd { from { opacity: 0; transform: translateX(28px); } }
@keyframes stepBack { from { opacity: 0; transform: translateX(-28px); } }
.wizard-nav { display: flex; gap: 10px; align-items: center; margin-top: 22px; }
.wizard-nav .grow { flex: 1; }
.wizard-nav .btn { height: 52px; font-size: 16px; }
.icon-btn.big { width: 52px; height: 52px; }
.opt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 14px; }
@media (min-width: 640px) { .opt-grid { grid-template-columns: repeat(3, 1fr); } }
.opt {
  border: 2px solid transparent; background: var(--surface); border-radius: var(--r-lg); padding: 12px; text-align: left;
  display: grid; gap: 1px; align-content: start; color: var(--text); transition: background .15s, border-color .15s, transform .18s var(--press);
}
.opt:hover { background: var(--surface-2); }
.opt:active { transform: scale(.96); }
.opt.on { border-color: var(--accent); background: var(--grad-soft); }
.opt-ico { width: 36px; height: 36px; border-radius: 11px; background: var(--surface-3); display: grid; place-items: center; margin-bottom: 8px; }
.opt-ico svg { width: 20px; height: 20px; }
.opt.on .opt-ico { background: var(--grad); color: #fff; animation: pop .32s var(--press); }
.opt-t { font-weight: 600; font-size: 15px; }
.opt-s { color: var(--muted); font-size: 12.5px; }
.advanced { padding: 6px 18px 18px; border-top: 1px solid var(--line); }
.advanced .field { margin-top: 12px; }
.advanced .input { background: var(--surface-2); }
.chev { color: var(--muted); transition: transform .2s; display: grid; }
.chev.open { transform: rotate(90deg); }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.slider-row { margin: 18px 0 8px; }
.row-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.row-head .t { font-weight: 600; }
.range { width: 100%; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 3px; background: var(--surface-3); outline: none; margin: 0; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 8px rgba(0, 0, 0, .4); cursor: pointer; }
.range::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 0; cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; color: var(--dim); font-size: 15px; margin-top: 8px; }

/* ---------- треки ---------- */
.gen { margin-bottom: 22px; animation: rise .4s var(--press) both; }
.gen-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; min-height: 40px; }
.gen-head .kind { color: var(--muted); font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gen-head .acts { display: flex; gap: 2px; flex: none; }
.track { margin-bottom: 18px; }
.track-main { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.cover {
  width: 72px; height: 72px; border-radius: 16px; flex: none; overflow: hidden; position: relative;
  display: grid; place-items: center; color: rgba(0, 0, 0, .3);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.track-info { flex: 1; min-width: 0; }
.track-title { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.02em; }
.track-meta { color: var(--muted); font-size: 14px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-sub { color: var(--muted); font-size: 14px; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .75; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 600; }
.status.wait { color: var(--warn); }
.status.bad { color: var(--bad); }

.wave { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 18px 0 8px; border-radius: 999px; background: var(--surface); }
.wave-play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--text); display: grid; place-items: center; flex: none; }
.wave-play:hover { background: var(--surface-2); }
.wave-play:disabled { opacity: .35; }
.wave-bars { flex: 1; height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 3px; cursor: pointer; min-width: 0; overflow: hidden; }
.wave-bars i { flex: 1; min-width: 2px; max-width: 4px; border-radius: 2px; background: #55555d; transition: background .2s; }
.wave-bars i.on { background: var(--accent); }
.wave.busy .wave-bars { cursor: default; }
.wave.busy .wave-bars i { animation: pulse 1.2s ease-in-out infinite; }
.wave.busy .wave-bars i:nth-child(3n) { animation-delay: -.4s; }
.wave.busy .wave-bars i:nth-child(3n+1) { animation-delay: -.8s; }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scaleY(.55); } 50% { opacity: 1; transform: scaleY(1); } }
.skeleton { background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 300% 100%; animation: sk 1.6s linear infinite; }
@keyframes sk { to { background-position: -150% 0; } }

/* ---------- лента ---------- */
.feed-tools { display: grid; gap: 12px; margin-bottom: 20px; }
.masonry { columns: 2; column-gap: 12px; }
@media (min-width: 720px) { .masonry { columns: 3; column-gap: 16px; } }
@media (min-width: 1000px) { .masonry { columns: 4; } }
.card {
  break-inside: avoid; position: relative; border-radius: var(--r-lg); overflow: hidden; margin-bottom: 12px;
  background: var(--surface); cursor: pointer; display: block; isolation: isolate; transition: transform .18s var(--press); animation: rise .45s var(--press) both;
}
.card:active { transform: scale(.97); }
@media (min-width: 720px) { .card { margin-bottom: 16px; } }
.card-cover { width: 100%; aspect-ratio: var(--ar, 1); display: grid; place-items: center; color: rgba(0, 0, 0, .28); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card::after { content: ''; position: absolute; inset: 35% 0 0; background: linear-gradient(transparent, rgba(0, 0, 0, .8)); z-index: 0; pointer-events: none; }
.card.pastel::after { display: none; }
.card-play {
  position: absolute; top: 12px; left: 12px; z-index: 1; width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: rgba(20, 20, 22, .5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: #fff; display: grid; place-items: center;
}
.card-body { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px; z-index: 1; color: #fff; }
.card.pastel .card-body { color: #121214; }
.card-kind { font-size: 13px; font-weight: 500; opacity: .72; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-title { font-size: 16px; font-weight: 700; line-height: 1.2; letter-spacing: -0.025em; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 15px; font-weight: 500; }
.card-foot .who { opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-like { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: inherit; padding: 4px 0 4px 8px; font-weight: 600; font-size: 16px; flex: none; }
.card-like.liked { color: var(--like); }
.card.pastel .card-like.liked { color: #d1103a; }
.sentinel { height: 1px; }

/* ---------- детальная карточка трека ---------- */
.detail-cover { width: 100%; max-width: 340px; aspect-ratio: 1; border-radius: var(--r-xl); overflow: hidden; margin: 0 auto 22px; display: grid; place-items: center; color: rgba(0, 0, 0, .28); }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.sheet h2.detail-title { padding: 0; }
.detail-title { font-size: 23px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; text-align: center; margin: 0 0 6px; }
.detail-author { text-align: center; color: var(--muted); }
.detail-actions { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 22px 0; }
.detail-actions .btn.primary { min-width: 160px; }
.copy-block { background: var(--surface); border-radius: var(--r-lg); padding: 16px 18px; margin-bottom: 12px; }
.copy-block .k { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.copy-block .k button { border: 0; background: var(--surface-2); color: var(--text); height: 38px; padding: 0 14px; border-radius: 999px; font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.copy-block .v { font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.copy-block .v.lyrics { max-height: 260px; overflow: auto; font-size: 17px; line-height: 1.6; }

/* ---------- оплата ---------- */
.balance-card { background: var(--grad-soft), var(--surface); border: 1px solid rgba(139, 123, 255, .25); border-radius: var(--r-xl); padding: 20px; }
.balance-card .n { font-size: 42px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.balance-card .l { color: var(--muted); margin-top: 10px; }
.price { font-weight: 700; font-size: 16px; white-space: nowrap; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--surface-3); color: var(--text); vertical-align: 2px; margin-left: 6px; }
.badge.hot { background: var(--grad); color: #fff; }
.badge.wait { background: rgba(255, 179, 64, .16); color: var(--warn); }
.badge.ok { background: rgba(48, 209, 88, .16); color: var(--ok); }
.badge.bad { background: rgba(255, 69, 58, .16); color: var(--bad); }
.copy-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.copy-line .v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; letter-spacing: -0.01em; }
.balance-card .unit { font-size: 22px; font-weight: 600; color: var(--muted); letter-spacing: -0.02em; }
.big-state { text-align: center; padding: 30px 6px; }
.big-state .ring { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 22px; display: grid; place-items: center; background: var(--surface); }
.big-state h2 { font-size: 23px; margin-bottom: 10px; }
.big-state p { color: var(--muted); max-width: 440px; margin: 0 auto 24px; }
.drop.drag { background: var(--surface-2); }

/* ---------- нижнее меню ---------- */
.tabbar-wrap {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; gap: 12px;
  padding: 0 16px calc(14px + var(--safe-b)); pointer-events: none;
}
.tabbar { pointer-events: auto; backdrop-filter: blur(24px) saturate(1.6); -webkit-backdrop-filter: blur(24px) saturate(1.6); }
.tabbar {
  display: flex; gap: 2px; padding: 6px; height: var(--tabbar-h); border-radius: 999px;
  background: rgba(30, 30, 33, .82); border: 1px solid var(--line); flex: 1; max-width: 440px;
}
.tab {
  flex: 1; border-radius: 999px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11.5px; font-weight: 600; transition: background .2s, color .2s, transform .18s var(--press); min-width: 0;
}
.tab svg { width: 21px; height: 21px; }
.tab:active { transform: scale(.92); }
.tab.on { background: var(--grad-soft); color: var(--text); }
.tab.on svg { color: var(--accent); animation: pop .4s var(--press); }

/* ---------- мини-плеер ---------- */
.player {
  position: fixed; z-index: 29; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 24px + var(--safe-b));
  width: min(540px, calc(100vw - 32px)); display: flex; align-items: center; gap: 12px; padding: 10px;
  border-radius: 24px; background: rgba(38, 38, 42, .94); border: 1px solid var(--line); overflow: hidden;
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); box-shadow: 0 16px 50px rgba(0, 0, 0, .5);
}
.player-cover { width: 48px; height: 48px; border-radius: 12px; overflow: hidden; flex: none; display: grid; place-items: center; color: rgba(0, 0, 0, .3); }
.player-cover img { width: 100%; height: 100%; object-fit: cover; }
.player-info { flex: 1; min-width: 0; }
.player-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-time { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.player-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .08); cursor: pointer; }
.player-progress i { display: block; height: 100%; width: 0; background: #f2f2f4; }

/* ---------- шторки ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: #161618; border-radius: 30px 30px 0 0;
  padding: 12px 20px calc(24px + var(--safe-b)); position: relative; animation: up .28s cubic-bezier(.2, .9, .3, 1);
}
.sheet::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto 14px; }
.sheet .close { position: absolute; top: 14px; right: 14px; }
.sheet h2 { padding-right: 50px; margin-bottom: 8px; font-size: 22px; line-height: 1.2; }
.sheet .lead { color: var(--muted); margin: 0 0 24px; }
.stack { display: grid; gap: 12px; }
@media (min-width: 640px) {
  .sheet-back { align-items: center; padding: 20px; }
  .sheet { border-radius: 30px; padding: 28px; }
  .sheet::before { display: none; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; padding-right: 50px; }
.profile-head .avatar { width: 56px; height: 56px; font-size: 22px; }
.fine { color: var(--dim); font-size: 14px; text-align: center; margin-top: 18px; }

/* ---------- тосты ---------- */
.toasts { position: fixed; top: calc(16px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 18px; font-size: 14px; background: rgba(48, 48, 52, .97); box-shadow: 0 12px 40px rgba(0, 0, 0, .5); font-weight: 500; animation: drop .25s; }
.toast.ok svg { color: var(--ok); }
.toast.bad svg { color: var(--bad); }
@keyframes drop { from { opacity: 0; transform: translateY(-12px); } }

.empty { text-align: center; padding: 44px 16px; }
.empty .ring { width: 88px; height: 88px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center; background: var(--surface); color: var(--muted); }
.empty .tg-ring { background: var(--tg); color: #fff; }
.empty .tg-ring svg { width: 46px; height: 46px; margin-left: -4px; }
.empty h3 { font-size: 20px; margin-bottom: 8px; }
.empty p { color: var(--muted); margin: 0 auto 24px; max-width: 380px; }

/* ---------- админка ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat { background: var(--surface); border-radius: var(--r-lg); padding: 16px 18px; }
.stat .n { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
.stat .l { color: var(--muted); font-size: 13px; }
.admin-order { background: var(--surface); border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px; display: grid; grid-template-columns: 84px 1fr; gap: 14px; }
.receipt { width: 84px; height: 84px; border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; color: var(--muted); border: 0; padding: 0; }
.receipt img { width: 100%; height: 100%; object-fit: cover; }
.admin-order .acts { grid-column: 1 / -1; display: flex; gap: 8px; }
.admin-order .acts .btn { flex: 1; }
.edit-card { background: var(--surface); border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px; }
.edit-card .input { background: var(--surface-2); font-size: 17px; padding: 13px 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lightbox { width: 100%; border-radius: 18px; }

@media (max-width: 420px) {
  .seg.compact button svg { display: none; }
  .seg.compact button { font-size: 16px; padding: 0 8px; }
  .top h1 { font-size: 25px; }
  .cover { width: 64px; height: 64px; border-radius: 14px; }
  .pill { padding: 0 12px; }
}

/* ---------- язык ---------- */
.flag { width: 22px; height: 22px; border-radius: 50%; overflow: hidden; flex: none; display: block; box-shadow: 0 0 0 1px rgba(255, 255, 255, .14); }
.flag svg { width: 100%; height: 100%; display: block; }
.flag.big { width: 40px; height: 40px; }
.lang-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.lang-switch button {
  height: 38px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .2s, color .2s; min-width: 0;
}
.lang-switch button .flag { opacity: .6; transition: opacity .2s; }
.lang-switch button.on { background: var(--grad-soft); color: var(--text); box-shadow: inset 0 0 0 1px rgba(139, 123, 255, .4); }
.lang-switch button:active { transform: scale(.96); }
.lang-switch button.on .flag { opacity: 1; }
.lang-switch button.on > svg { color: var(--ok); }

.lang-pick { min-height: calc(100vh - 140px); display: flex; flex-direction: column; justify-content: center; padding: calc(30px + var(--safe-t)) 0 20px; text-align: center; }
.lang-pick h1 { font-size: 27px; line-height: 1.15; letter-spacing: -0.03em; margin: 26px 0 28px; }
.lang-pick h1 span { color: var(--muted); font-size: 18px; font-weight: 600; }
.lang-orb { position: relative; width: 170px; height: 170px; margin: 0 auto; display: grid; place-items: center; }
.lang-orb .orb { inset: 0; }
.lang-cards { display: grid; gap: 12px; text-align: left; }
.lang-card {
  text-align: left; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-lg); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); transition: background .15s, transform .12s;
  animation: rise .5s cubic-bezier(.2, .9, .3, 1) both; animation-delay: calc(.15s + var(--i) * .1s);
}
.lang-card:hover { background: var(--surface-2); }
.lang-card:active { transform: scale(.98); }
.lang-card .grow { flex: 1; display: grid; }
.lang-card .t { font-size: 18px; font-weight: 700; }
.lang-card .s { color: var(--muted); font-size: 15px; }

/* ---------- главная ---------- */
.hero { position: relative; text-align: center; padding: 6px 0 4px; margin-top: 14px; }
.hero-visual { position: relative; width: 170px; height: 170px; margin: 0 auto 4px; display: grid; place-items: center; }
.orb {
  position: absolute; inset: 18px; border-radius: 50%;
  background: conic-gradient(from 0deg, #ff6a88, #ffb86b, #7cf2d4, #6a8bff, #c56bff, #ff6a88);
  filter: blur(26px); opacity: .85; animation: spin 9s linear infinite, breathe 4s ease-in-out infinite;
}
.orb.orb2 { inset: 40px; filter: blur(14px); opacity: .9; animation-duration: 6s, 3s; animation-direction: reverse, normal; }
.ring-pulse { position: absolute; inset: 30px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); animation: ripple 3s ease-out infinite; }
.ring-pulse.r2 { animation-delay: 1.5s; }
.eq { position: relative; z-index: 1; display: flex; align-items: center; gap: 4px; height: 56px; }
.eq i { width: 5px; height: var(--h); border-radius: 4px; background: #fff; box-shadow: 0 0 12px rgba(255, 255, 255, .6); animation: eq 1.1s ease-in-out infinite; animation-delay: var(--d); }
.lang-orb .eq { height: 56px; }
.notes-float { position: absolute; inset: -10px -40px; pointer-events: none; }
.notes-float span {
  position: absolute; bottom: 10%; left: var(--x); font-size: 24px; color: rgba(255, 255, 255, .85);
  text-shadow: 0 0 14px rgba(255, 255, 255, .5); opacity: 0; animation: floatUp var(--s) ease-in infinite; animation-delay: var(--t);
}
.hero-title { font-size: 29px; line-height: 1.1; letter-spacing: -0.035em; font-weight: 800; margin: 0; }
.typer-line {
  display: block; min-height: 2.2em; margin-top: 4px;
  background: linear-gradient(90deg, #ffb86b, #ff6a88, #c56bff, #6a8bff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.caret { display: inline-block; width: 3px; height: .95em; margin-left: 3px; vertical-align: -0.1em; background: #f2f2f4; border-radius: 2px; animation: blink 1s step-end infinite; }
.hero-sub { color: var(--muted); margin: 8px auto 16px; max-width: 420px; font-size: 14px; }
.cta { height: 54px; font-size: 17px; position: relative; overflow: hidden; box-shadow: 0 10px 40px rgba(197, 107, 255, .25); }
.cta::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .7), transparent); animation: shine 3.2s ease-in-out infinite;
}
.cta-2 { margin-top: 10px; }
.hero-meta { color: var(--dim); font-size: 13px; margin-top: 10px; }

.scen-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 640px) { .scen-grid { grid-template-columns: repeat(4, 1fr); } }
.scen {
  position: relative; overflow: hidden; border: 0; border-radius: var(--r-lg); padding: 12px; min-height: 96px; text-align: left; color: #121214;
  background: var(--g); display: grid; align-content: end; gap: 1px; isolation: isolate;
  transition: transform .15s; animation: rise .5s cubic-bezier(.2, .9, .3, 1) both; animation-delay: calc(var(--i) * .05s);
}
.scen:active { transform: scale(.97); }
.scen::before { content: ''; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 40%, rgba(255, 255, 255, .35) 50%, transparent 60%); background-size: 250% 100%; animation: sheen 5s ease-in-out infinite; animation-delay: calc(var(--i) * .4s); z-index: -1; }
.scen-e { position: absolute; top: 9px; right: 10px; font-size: 26px; animation: bob 3s ease-in-out infinite; animation-delay: calc(var(--i) * -.37s); }
.scen.wide { grid-column: 1 / -1; min-height: 88px; color: #fff; }
.scen.wide .scen-t { font-size: 18px; }
.scen-t { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.scen-s { font-size: 12px; font-weight: 600; opacity: .7; }

.invite-card {
  display: flex; align-items: center; gap: 12px; margin-top: 22px; padding: 12px 12px 12px 14px; border-radius: var(--r-xl); transition: transform .18s var(--press);
  background: linear-gradient(135deg, rgba(255, 184, 107, .18), rgba(197, 107, 255, .18)); border: 1px solid rgba(255, 255, 255, .1);
}
.invite-card .grow { flex: 1; min-width: 0; display: grid; }
.invite-card:active { transform: scale(.98); }
.invite-card .t { font-weight: 700; font-size: 15px; }
.invite-card .s { color: var(--muted); font-size: 12.5px; }
.invite-card .go { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }
.invite-h { font-size: 24px; letter-spacing: -0.03em; margin-bottom: 8px; }
.gift-ico { font-size: 28px; animation: wiggle 2.6s ease-in-out infinite; }

.how { display: grid; gap: 10px; }
.how-step { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--r-lg); background: var(--surface); color: var(--muted); }
.how-step .grow { flex: 1; display: grid; }
.how-step .t { color: var(--text); font-weight: 600; }
.how-step .s { font-size: 13px; }
.how-n { width: 30px; height: 30px; font-size: 14px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; color: #0e0e10; background: linear-gradient(135deg, #ffb86b, #ff6a88); }

.invite-hero { text-align: center; padding: 10px 0 6px; }
.gift-big { position: relative; font-size: 64px; line-height: 1; display: inline-block; animation: bob 3s ease-in-out infinite; margin-bottom: 14px; }
.gift-big i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #ffd66b; top: 50%; left: 50%; animation: spark 2.4s ease-out infinite; }
.gift-big i:nth-child(2) { background: #ff6a88; animation-delay: .8s; --dx: -60px; }
.gift-big i:nth-child(3) { background: #7cf2d4; animation-delay: 1.6s; --dx: 50px; }
.invite-hero .lead { color: var(--muted); max-width: 440px; margin: 0 auto 22px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { scale: 1; } 50% { scale: 1.08; } }
@keyframes ripple { from { transform: scale(.75); opacity: .8; } to { transform: scale(1.35); opacity: 0; } }
@keyframes eq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
@keyframes floatUp { 0% { transform: translateY(0) rotate(-8deg); opacity: 0; } 15% { opacity: .9; } 100% { transform: translateY(-190px) rotate(12deg); opacity: 0; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes shine { 0%, 55% { left: -60%; } 100% { left: 130%; } }
@keyframes sheen { 0%, 70% { background-position: 150% 0; } 100% { background-position: -100% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-12deg); } 90% { transform: rotate(10deg); } 95% { transform: rotate(-6deg); } }
@keyframes spark { 0% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx, 10px)), -90px) scale(.2); opacity: 0; } }

@media (max-width: 420px) {
  .hero-title { font-size: 26px; }
  .hero-visual { width: 150px; height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
  .notes-float, .ring-pulse, .cta::after { display: none; }
}

/* ---------- не хватает нот ---------- */
.nc { text-align: center; padding-top: 6px; }
.nc h2 { padding: 0; }
.nc-ico { width: 72px; height: 72px; border-radius: 50%; margin: 4px auto 14px; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: 0 10px 34px rgba(197, 107, 255, .4); animation: pop .5s var(--press); }
.nc .lead { margin: 6px auto 20px; max-width: 380px; font-size: 15px; }

/* ---------- админка: обзор ---------- */
.admin-tabs button { position: relative; }
.cnt { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent-2); color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; margin-left: 2px; }
.callout { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-lg); margin-bottom: 12px; background: rgba(255, 179, 64, .12); color: #ffd28a; border: 1px solid rgba(255, 179, 64, .25); font-size: 14px; }
.callout .grow { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; min-width: 0; animation: rise .4s var(--press) both; }
.kpi:nth-child(2) { animation-delay: .04s; } .kpi:nth-child(3) { animation-delay: .08s; } .kpi:nth-child(4) { animation-delay: .12s; }
.kpi:nth-child(5) { animation-delay: .16s; } .kpi:nth-child(6) { animation-delay: .2s; } .kpi:nth-child(7) { animation-delay: .24s; } .kpi:nth-child(8) { animation-delay: .28s; }
.kpi-l { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-v { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; margin: 4px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpis.small .kpi-v { font-size: 20px; }
.kpi-s { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--dim); font-size: 12px; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px; font-weight: 700; font-size: 12px; }
.delta.up { background: rgba(48, 209, 88, .14); color: var(--ok); }
.delta.down { background: rgba(255, 69, 58, .14); color: var(--bad); }
.delta.warn { background: rgba(255, 179, 64, .16); color: var(--warn); }
.panels { display: grid; gap: 8px; margin-bottom: 12px; }
@media (min-width: 720px) { .panels { grid-template-columns: 1fr 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px 14px; margin-bottom: 8px; animation: rise .45s var(--press) both; }
.panels .panel { margin-bottom: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.panel-head b { font-size: 18px; letter-spacing: -0.02em; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 96px; overflow: visible; }
.chart .bar { fill: var(--accent); opacity: .85; transition: opacity .15s; }
.chart .bar.last { opacity: 1; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart [data-tip].hover .bar { opacity: 1; fill: #a89cff; }
.chart [data-tip].hover .hit { fill: rgba(255, 255, 255, .05); }
.chart .base { stroke: var(--line); stroke-width: 1; }
.chart-x { display: flex; justify-content: space-between; color: var(--dim); font-size: 11px; margin-top: 6px; }
.chart-tip { position: absolute; top: -8px; transform: translate(-50%, -100%); background: #2a2a2f; border: 1px solid var(--line); padding: 4px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
.funnel { display: grid; gap: 12px; }
.f-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; }
.f-top b { font-variant-numeric: tabular-nums; }
.f-track { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.f-track i { display: block; height: 100%; border-radius: 4px; background: var(--accent); animation: grow .8s var(--press) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.top-list { display: grid; }
.top-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 14px; }
.top-row + .top-row { border-top: 1px solid var(--line); }
.top-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; }
.top-row:first-child .rank { background: var(--grad); color: #fff; }
