/* Цвета берутся из темы Telegram (--tg-theme-*), вне Telegram — свои светлые/тёмные. */
:root {
  --fb-bg: #f3f2f8;
  --fb-card: #ffffff;
  --fb-text: #0d0d12;
  --fb-hint: #85849a;
  --fb-accent: #7353ff;

  --bg: var(--tg-theme-secondary-bg-color, var(--fb-bg));
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, var(--fb-card)));
  --text: var(--tg-theme-text-color, var(--fb-text));
  --hint: var(--tg-theme-hint-color, var(--fb-hint));
  --link: var(--tg-theme-link-color, var(--fb-accent));
  --accent: var(--tg-theme-button-color, var(--fb-accent));
  --accent-text: var(--tg-theme-button-text-color, #fff);
  --danger: var(--tg-theme-destructive-text-color, #ff453a);
  --ok: #22b968;
  --warn: #f5a524;

  /* Фирменный градиент — поменяйте под бренд */
  --brand-a: #7b5cff;
  --brand-b: #d35cd9;
  --brand-c: #5c7dff;
  --brand: linear-gradient(135deg, var(--brand-a) 0%, var(--brand-b) 100%);
  --brand-glow: rgba(123, 92, 255, .32);

  --stroke: rgba(128, 128, 140, .16);
  --soft: rgba(128, 128, 140, .10);
  --softer: rgba(128, 128, 140, .06);
  --radius: 22px;
  --radius-sm: 15px;
  --gap: 12px;
  --shadow: 0 1px 2px rgba(20, 10, 60, .04), 0 6px 20px rgba(20, 10, 60, .06);
  --shadow-lg: 0 2px 6px rgba(20, 10, 60, .05), 0 18px 44px rgba(20, 10, 60, .12);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --tabbar-h: 64px;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --fb-bg: #0c0c12;
    --fb-card: #17171f;
    --fb-text: #f4f4f7;
    --fb-hint: #8d8d9c;
    --fb-accent: #9278ff;
    --shadow: 0 0 0 1px rgba(255, 255, 255, .04);
    --shadow-lg: 0 0 0 1px rgba(255, 255, 255, .05), 0 20px 50px rgba(0, 0, 0, .45);
    --brand-glow: rgba(123, 92, 255, .4);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
a { color: var(--link); text-decoration: none; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.num { font-variant-numeric: tabular-nums; }
.hint { color: var(--hint); }
.muted { color: var(--hint); font-size: 13px; }

/* ---------- каркас ---------- */
.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: var(--tg-viewport-stable-height, 100dvh);
  padding: 8px calc(16px + var(--safe-r)) calc(var(--tabbar-h) + var(--safe-b) + 28px) calc(16px + var(--safe-l));
}
.app.no-tabs { padding-bottom: calc(100px + var(--safe-b)); }
.view-host { overflow-x: clip; margin: 0 -16px; padding: 0 16px; } /* сдвиг при переходе не даёт горизонтальный скролл */
@supports not (overflow: clip) { .view-host { overflow-x: hidden; } }

/* фон: мягкие пятна бренда, неподвижные — не мешают скроллу */
.app::before {
  content: ""; position: fixed; inset: -20% -10% auto; height: 70vh; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 50% at 20% 20%, rgba(123, 92, 255, .14), transparent 70%),
    radial-gradient(35% 40% at 85% 10%, rgba(211, 92, 217, .12), transparent 70%);
}

/* переходы между экранами: вперёд — справа, назад — слева, вкладки — снизу */
.view > * { animation: rise .42s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.view.fwd > * { animation-name: from-right; }
.view.back > * { animation-name: from-left; }
.view.still > * { animation: none; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes from-right { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes from-left { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: rise .45s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: 60ms; }
.stagger > *:nth-child(2) { animation-delay: 110ms; }
.stagger > *:nth-child(3) { animation-delay: 160ms; }
.stagger > *:nth-child(4) { animation-delay: 210ms; }
.stagger > *:nth-child(5) { animation-delay: 260ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }
.stagger > *:nth-child(n+7) { animation-delay: 340ms; }

.topbar { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 4px 0 8px; animation: fade .3s var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.topbar .title { font-size: 22px; font-weight: 800; flex: 1; min-width: 0; letter-spacing: -.02em; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; background: var(--card); box-shadow: var(--shadow);
  transition: transform .2s var(--spring);
}
.icon-btn:active { transform: scale(.9); }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none; overflow: hidden; position: relative;
  display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--brand);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; animation: fade .4s; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; box-shadow: 0 0 0 4px var(--card), 0 0 0 6px rgba(123, 92, 255, .35); }
.who { flex: 1; min-width: 0; }
.who b { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { color: var(--hint); font-size: 13px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 5px 0 14px; white-space: nowrap;
  border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-weight: 700;
  transition: transform .2s var(--spring);
}
.pill:active { transform: scale(.94); }
.pill .plus { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; }
.pill.bump { animation: bump .5s var(--spring); }
@keyframes bump { 40% { transform: scale(1.1); } }

/* ---------- карточки ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card, .section + .card, .card + .section { margin-top: var(--gap); }
.section { margin-top: 24px; }
.section-title { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--hint); margin: 0 4px 10px; }
.stack > * + * { margin-top: var(--gap); }

/* hero: переливающийся градиент, блики и плавающие звёзды */
.hero {
  position: relative; overflow: hidden; color: #fff; isolation: isolate;
  background: linear-gradient(120deg, var(--brand-a), var(--brand-b), var(--brand-c), var(--brand-a));
  background-size: 300% 300%; animation: aurora 14s ease-in-out infinite;
  border-radius: 26px; padding: 20px; box-shadow: 0 14px 36px var(--brand-glow);
}
.view > .hero { animation: rise .42s var(--ease) both, aurora 14s ease-in-out infinite; }
@keyframes aurora { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none; z-index: -1;
  background: radial-gradient(circle, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 70%);
}
.hero::before { width: 260px; height: 260px; right: -90px; top: -110px; animation: drift 9s ease-in-out infinite; }
.hero::after { width: 180px; height: 180px; left: -60px; bottom: -110px; animation: drift 11s ease-in-out infinite reverse; }
@keyframes drift { 50% { transform: translate(-18px, 14px) scale(1.08); } }
.hero .sparkles { position: absolute; inset: 0; pointer-events: none; z-index: -1; }
.hero .sparkles i {
  position: absolute; width: 10px; height: 10px; opacity: 0; color: #fff;
  background: currentColor; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: twinkle 4s ease-in-out infinite;
}
.hero .sparkles i:nth-child(1) { right: 22%; top: 18%; animation-delay: .2s; }
.hero .sparkles i:nth-child(2) { right: 9%; top: 52%; width: 7px; height: 7px; animation-delay: 1.4s; }
.hero .sparkles i:nth-child(3) { right: 34%; top: 66%; width: 6px; height: 6px; animation-delay: 2.6s; }
.hero .sparkles i:nth-child(4) { right: 48%; top: 14%; width: 8px; height: 8px; animation-delay: 3.3s; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.4) rotate(0); } 50% { opacity: .9; transform: scale(1) rotate(45deg); } }
.hero .label { opacity: .88; font-size: 14px; font-weight: 500; }
.hero .amount { font-size: clamp(32px, 11vw, 44px); font-weight: 800; letter-spacing: -.03em; margin: 2px 0 16px; line-height: 1.1; }
.hero .row { display: flex; gap: 10px; }
.hero .btn-glass {
  flex: 1; height: 46px; border-radius: 15px; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(255, 255, 255, .2); color: #fff; font-weight: 700; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .22); transition: background .2s, transform .2s var(--spring);
}
.hero .btn-glass:active { background: rgba(255, 255, 255, .32); transform: scale(.96); }

.products { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.product {
  position: relative; overflow: hidden; text-align: left; background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; min-height: 150px;
  transition: transform .25s var(--spring), box-shadow .25s;
}
.product::after { /* блик при наведении/нажатии */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .35) 50%, transparent 65%);
  transform: translateX(-120%); transition: transform .7s var(--ease);
}
.product:active { transform: scale(.96); }
.product:active::after { transform: translateX(120%); }
.product b { font-size: 16px; display: block; }
.product small { color: var(--hint); font-size: 13px; }
.product .price { margin-top: auto; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.product .go { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--hint); transition: transform .25s var(--spring), background .2s, color .2s; }
.tile { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; color: #fff; position: relative; }
.tile.sm { width: 40px; height: 40px; border-radius: 12px; }
.product .tile { box-shadow: 0 8px 18px -6px var(--tile-glow, rgba(0, 0, 0, .3)); transition: transform .35s var(--spring); }
.k-stars { background: linear-gradient(135deg, #ffcf47, #ff8a1f); --tile-glow: rgba(255, 150, 30, .55); }
.k-premium { background: linear-gradient(135deg, #8b5cf6, #e05ad8); --tile-glow: rgba(160, 90, 240, .55); }
.k-ton { background: linear-gradient(135deg, #0098ea, #39c6ff); --tile-glow: rgba(0, 152, 234, .5); }
.k-steam { background: linear-gradient(135deg, #1b2838, #3d6a8f); --tile-glow: rgba(30, 50, 80, .55); }
.k-stars svg { animation: spin-slow 12s linear infinite; }
@keyframes spin-slow { to { transform: rotate(360deg); } }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.feature { padding: 12px; border-radius: var(--radius-sm); background: var(--card); box-shadow: var(--shadow); }
.feature svg { color: var(--accent); margin-bottom: 8px; }
.feature b { display: block; font-size: 13px; }
.feature span { color: var(--hint); font-size: 12px; line-height: 1.3; display: block; margin-top: 2px; }

.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; width: 100%; text-align: left; min-height: 58px; position: relative; overflow: hidden; }
.list-item + .list-item { border-top: 1px solid var(--stroke); }
.list-item .main { flex: 1; min-width: 0; }
.list-item .main b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .main span { display: block; color: var(--hint); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .end { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.list-item .end b { display: block; font-weight: 700; }
.list-item > .hint { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--soft); color: var(--accent); }
.chev { color: var(--hint); transition: transform .2s var(--ease); }
button.list-item { transition: background .15s; }
button.list-item:active { background: var(--soft); }
button.list-item:active .chev { transform: translateX(3px); }
.list.orders .list-item { animation: rise .4s var(--ease) both; }

.chip, .option, .btn-glass, .segmented button { position: relative; overflow: hidden; }
/* ripple: создаётся в app.js по pointerdown */
.ripple { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: .14; transform: scale(0); animation: ripple .55s var(--ease) forwards; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* ---------- формы ---------- */
.field-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--hint); margin: 0 2px 8px; gap: 8px; }
.input-wrap {
  display: flex; align-items: center; gap: 8px; height: 54px; padding: 0 8px 0 14px; border-radius: var(--radius-sm);
  background: var(--soft); border: 1.5px solid transparent; transition: border-color .2s, background .2s, box-shadow .2s;
}
.input-wrap:focus-within { border-color: var(--accent); background: transparent; box-shadow: 0 0 0 4px rgba(123, 92, 255, .14); }
.input-wrap.invalid { border-color: var(--danger); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.input-wrap .prefix { color: var(--hint); font-weight: 700; }
.input-wrap input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 17px; font-weight: 500; }
.input-wrap input::placeholder { color: var(--hint); opacity: .6; font-weight: 400; }
.chip-self {
  height: 36px; padding: 0 12px; border-radius: 11px; background: var(--card); font-weight: 700; font-size: 14px; flex: none;
  display: inline-flex; align-items: center; gap: 6px; box-shadow: var(--shadow); transition: background .2s, color .2s, transform .2s var(--spring);
}
.chip-self:active { transform: scale(.94); }
.chip-self.on { background: var(--accent); color: var(--accent-text); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  height: 38px; padding: 0 14px; border-radius: 12px; background: var(--soft); font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px; transition: background .2s, color .2s, transform .2s var(--spring), box-shadow .2s;
}
.chip svg { color: #ffaa1f; }
.chip:active { transform: scale(.92); }
.chip.on { background: var(--accent); color: var(--accent-text); box-shadow: 0 6px 16px -6px var(--accent); animation: pop-in .35s var(--spring); }
.chip.on svg { color: currentColor; }
@keyframes pop-in { 50% { transform: scale(1.08); } }

.preview { display: flex; align-items: center; gap: 10px; margin-top: 12px; min-height: 42px; }
.preview > * { animation: rise .3s var(--ease) both; }
.preview .avatar { width: 40px; height: 40px; font-size: 15px; }
.preview .ok { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--ok); animation: pop .45s var(--spring) both; }
.preview .err { color: var(--danger); font-size: 14px; font-weight: 500; }
.dots::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.options { display: grid; gap: 10px; }
.option {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-align: left; width: 100%;
  border-radius: var(--radius-sm); background: var(--soft); border: 2px solid transparent;
  transition: border-color .2s, background .2s, transform .2s var(--spring);
}
.option:active { transform: scale(.98); }
.option.on { border-color: var(--accent); background: transparent; box-shadow: 0 8px 22px -12px var(--accent); }
.option .radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--stroke); display: grid; place-items: center; flex: none; transition: border-color .2s; }
.option.on .radio { border-color: var(--accent); }
.option .radio::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform .3s var(--spring); }
.option.on .radio::after { transform: scale(1); }
.option .main { flex: 1; min-width: 0; }
.option .main b { display: block; font-size: 16px; }
.option .main span { color: var(--hint); font-size: 13px; }
.option .main .badge { color: #fff; font-size: 12px; }
.option .end { font-weight: 800; font-size: 16px; }
.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 7px;
  font-size: 12px; font-weight: 800; background: var(--brand); color: #fff; margin-left: 6px; vertical-align: 2px;
}

.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(245, 165, 36, .12); font-size: 13px; line-height: 1.4; }
.note svg { color: var(--warn); margin-top: 1px; }

.summary .row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.summary .row span:first-child { color: var(--hint); flex: none; }
.summary .row span:last-child { text-align: right; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.summary .total { border-top: 1px dashed var(--stroke); margin-top: 6px; padding-top: 12px; font-size: 18px; }
.summary .total span:last-child { font-weight: 800; }
.summary .short span:last-child { color: var(--danger); font-weight: 800; }
.flash { animation: flash .5s var(--ease); }
@keyframes flash { 30% { color: var(--accent); transform: scale(1.06); } }
.summary .total span:last-child { display: inline-block; transform-origin: right center; }

.btn {
  position: relative; overflow: hidden;
  width: 100%; height: 54px; border-radius: 17px; font-weight: 800; font-size: 16px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: #fff; transition: transform .2s var(--spring), opacity .2s, filter .2s;
}
.btn::before { /* лёгкий перелив на основной кнопке */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .25) 50%, transparent 70%);
  transform: translateX(-100%); animation: sheen 3.6s ease-in-out infinite 1s;
}
@keyframes sheen { 0%, 60% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; filter: saturate(.6); }
.btn:disabled::before, .btn.secondary::before { display: none; }
.btn.secondary { background: var(--soft); color: var(--text); }
.btn.sm { height: 44px; font-size: 15px; border-radius: 13px; }
.btn-row { display: flex; gap: 10px; }
.btn .spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .8s linear infinite; }

.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 14px calc(16px + var(--safe-r)) calc(12px + var(--safe-b)) calc(16px + var(--safe-l));
  background: linear-gradient(to top, var(--bg) 65%, transparent);
  animation: up .35s var(--ease);
}
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.actionbar .btn { max-width: 528px; margin: 0 auto; box-shadow: 0 10px 28px var(--brand-glow); }

/* ---------- таб-бар со скользящим индикатором ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--safe-b)); z-index: 20;
  display: flex; gap: 4px; padding: 6px; border-radius: 24px;
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .14); border: 1px solid var(--stroke);
  animation: tab-in .45s var(--spring);
}
@keyframes tab-in { from { transform: translate(-50%, 140%); } to { transform: translateX(-50%); } }
@supports not (background: color-mix(in srgb, red 50%, transparent)) { .tabbar { background: var(--card); } }
.tabbar .indicator {
  position: absolute; top: 6px; left: 0; height: 52px; border-radius: 18px; background: var(--soft); z-index: -1;
  transition: transform .4s var(--spring), width .4s var(--spring);
}
.tabbar { isolation: isolate; }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 88px; height: 52px; border-radius: 18px; color: var(--hint); font-size: 11px; font-weight: 700; transition: color .25s;
}
.tab svg { transition: transform .35s var(--spring); }
.tab.on { color: var(--accent); }
.tab.on svg { transform: translateY(-1px) scale(1.12); }

/* ---------- статусы, пустые состояния ---------- */
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 7px; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.pending { color: var(--warn); background: rgba(245, 165, 36, .14); }
.status.pending::before { animation: pulse 1.4s ease-in-out infinite; }
.status.done { color: var(--ok); background: rgba(34, 185, 104, .14); }
.status.failed { color: var(--danger); background: rgba(255, 69, 58, .12); }
@keyframes pulse { 50% { opacity: .3; transform: scale(.7); } }

.empty { text-align: center; padding: 48px 24px; }
.empty .tile { margin: 0 auto 16px; width: 76px; height: 76px; border-radius: 24px; animation: float 3.2s ease-in-out infinite; }
.empty p { color: var(--hint); margin: 6px 0 20px; }
@keyframes float { 50% { transform: translateY(-8px) rotate(-4deg); } }

.result { text-align: center; padding: 32px 8px 8px; position: relative; overflow: hidden; }
.result .ring { width: 100px; height: 100px; margin: 0 auto 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; position: relative; }
.result .ring.ok { background: var(--ok); animation: pop .6s var(--spring) both; box-shadow: 0 14px 34px rgba(34, 185, 104, .4); }
.result .ring.ok path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw .45s .3s var(--ease) forwards; }
.result .ring.fail { background: var(--danger); animation: pop .5s var(--spring) both, shake .4s .5s; }
.result .ring.wait { background: var(--brand); box-shadow: 0 14px 34px var(--brand-glow); }
.result .ring.wait svg { animation: spin 1.1s linear infinite; }
.result .ring.wait::before, .result .ring.wait::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--brand-a); animation: wave 2s ease-out infinite;
}
.result .ring.wait::after { animation-delay: 1s; }
@keyframes wave { from { transform: scale(1); opacity: .6; } to { transform: scale(1.7); opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.result h2 { margin: 0 0 8px; font-size: 24px; letter-spacing: -.02em; }
.result p { color: var(--hint); margin: 0 auto; max-width: 340px; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* конфетти на успехе */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i {
  position: absolute; left: 50%; top: 38%; width: 8px; height: 12px; border-radius: 2px;
  animation: burst 1.25s cubic-bezier(.15, .7, .3, 1) forwards;
}
@keyframes burst {
  from { transform: translate(-50%, -50%) rotate(0); opacity: 1; }
  to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; }
}

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 12px; border-radius: var(--radius-sm); background: var(--soft); display: flex; gap: 10px; align-items: center; min-width: 0; }
.stat > div:last-child { min-width: 0; }
.stat b { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat span { color: var(--hint); font-size: 12px; }

.ref-link { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: var(--radius-sm); background: var(--soft); margin: 14px 0 10px; }
.ref-link code { flex: 1; min-width: 0; font: 600 14px ui-monospace, SFMono-Regular, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.level { text-align: center; padding: 12px 6px; border-radius: var(--radius-sm); background: var(--soft); }
.level b { display: block; font-size: 20px; }
.level span { font-size: 12px; color: var(--hint); }
.level i { font-style: normal; display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 800; color: var(--accent); }
.earn { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; padding: 12px 0; border-top: 1px solid var(--stroke); border-bottom: 1px solid var(--stroke); margin-bottom: 14px; gap: 4px; }
.earn b { display: block; font-size: 16px; }
.earn span { font-size: 12px; color: var(--hint); }

.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; flex-wrap: wrap; }
.setting + .setting { border-top: 1px solid var(--stroke); }
.icon-btn.prefs { width: auto; padding: 0 12px; border-radius: 999px; height: 38px; font-size: 13px; font-weight: 800; color: var(--hint); }
.segmented { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--soft); position: relative; }
.segmented button { height: 32px; padding: 0 14px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--hint); transition: background .25s, color .25s, box-shadow .25s; }
.segmented button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }

.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--soft) 25%, var(--stroke) 50%, var(--soft) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.toast {
  position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 50;
  transform: translate(-50%, -160%) scale(.9); opacity: 0; transition: transform .45s var(--spring), opacity .25s;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 16px; font-weight: 700; font-size: 14px;
  background: rgba(30, 30, 38, .94); color: #fff; box-shadow: 0 12px 34px rgba(0, 0, 0, .28);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; }
.toast.error { background: rgba(220, 50, 50, .95); }

/* ---------- наведение мышью (десктоп) ---------- */
@media (hover: hover) and (pointer: fine) {
  .product:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
  .product:hover::after { transform: translateX(120%); }
  .product:hover .tile { transform: rotate(-8deg) scale(1.08); }
  .product:hover .go { background: var(--accent); color: var(--accent-text); transform: translateX(2px); }
  button.list-item:hover { background: var(--softer); }
  button.list-item:hover .chev { transform: translateX(3px); }
  .chip:hover:not(.on), .option:hover:not(.on) { background: var(--stroke); }
  .btn:hover:not(:disabled) { filter: brightness(1.06); }
  .tab:hover:not(.on) { color: var(--text); }
  .icon-btn:hover, .pill:hover { box-shadow: var(--shadow-lg); }
}

/* ---------- планшет и десктоп ---------- */
@media (min-width: 760px) {
  .app { max-width: 1000px; padding: 24px calc(32px + var(--safe-r)) 120px calc(32px + var(--safe-l)); }
  .app.no-tabs { padding-bottom: 120px; }
  .home-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; align-items: start; margin-top: 24px; }
  .home-grid .section:first-child { margin-top: 0; }
  .home-grid > div > .section:first-child { margin-top: 0; }
  .product { min-height: 172px; }
  .split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: 22px; align-items: start; }
  .split .aside { position: sticky; top: 16px; }
  .split .aside .btn { margin-top: 14px; }
  .actionbar.desktop-hide { display: none !important; }
  .profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
  .profile-grid > .card { margin-top: 0 !important; }
  .tabbar { top: 24px; bottom: auto; left: auto; right: max(32px, calc((100vw - 1000px) / 2 + 32px)); transform: none; box-shadow: var(--shadow); animation: fade .4s; }
  .tabbar .indicator { height: 40px; border-radius: 14px; }
  .tab { flex-direction: row; width: auto; height: 40px; padding: 0 14px; gap: 8px; font-size: 14px; border-radius: 14px; }
  .topbar { padding-right: 420px; min-height: 64px; }
  .hero { padding: 26px; }
  .hero .amount { font-size: 52px; }
  .list.orders { display: grid; grid-template-columns: 1fr 1fr; }
  .list.orders .list-item:nth-child(2) { border-top: 0; }
  .list.orders .list-item:nth-child(even) { border-left: 1px solid var(--stroke); }
}
@media (min-width: 1200px) {
  .app { max-width: 1120px; }
  .tabbar { right: max(32px, calc((100vw - 1120px) / 2 + 32px)); }
  .products { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 759px) {
  .split .aside { margin-top: var(--gap); }
  .split .aside .btn { display: none; }
}
/* узкие телефоны */
@media (max-width: 360px) {
  .app { padding-left: calc(12px + var(--safe-l)); padding-right: calc(12px + var(--safe-r)); }
  .features { grid-template-columns: 1fr; }
  .feature { display: flex; gap: 10px; align-items: center; }
  .feature svg { margin: 0; }
  .products { gap: 10px; }
  .product { padding: 14px; min-height: 140px; }
  .tab { width: 74px; }
  .stats { grid-template-columns: 1fr; }
  .topbar .who span { display: none; }
  .hero { padding: 16px; }
}
/* телефон боком: экономим высоту */
@media (max-height: 480px) and (orientation: landscape) {
  .tabbar { bottom: calc(6px + var(--safe-b)); padding: 4px; }
  .tab { height: 40px; flex-direction: row; width: auto; padding: 0 12px; gap: 6px; }
  .tabbar .indicator { height: 40px; top: 4px; }
  .app { padding-bottom: calc(60px + var(--safe-b)); }
  .result { padding-top: 12px; }
  .result .ring { width: 72px; height: 72px; margin-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .hero { animation: none; }
  .confetti { display: none; }
}
