/* ==========================================================================
   Nver design system — «ночная карамель»
   Тёмная тема по умолчанию, светлая через [data-theme="light"].
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@500;700;900&family=Manrope:wght@400;500;600;700;800&family=Noto+Sans+Armenian:wght@400;600;800&display=swap');

:root {
  --bg: #0B0714;
  --bg-2: #140B24;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.1);
  --surface-solid: #1A1030;
  --line: rgba(255, 255, 255, 0.1);
  --text: #FFF7F2;
  --text-2: rgba(255, 247, 242, 0.68);
  --text-3: rgba(255, 247, 242, 0.42);
  --coral: #FF5E7E;
  --apricot: #FF9A3C;
  --violet: #B26BFF;
  --mint: #5BE3B0;
  --sky: #3CC9FF;
  --danger: #FF4D6A;
  --grad: linear-gradient(120deg, var(--coral) 0%, var(--apricot) 45%, var(--violet) 100%);
  --grad-soft: linear-gradient(120deg, rgba(255, 94, 126, .18), rgba(178, 107, 255, .18));
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, .6);
  --glow: 0 10px 40px -8px rgba(255, 94, 126, .55);
  --r-sm: 12px; --r: 20px; --r-lg: 28px; --r-xl: 36px;
  --font-display: 'Unbounded', 'Noto Sans Armenian', system-ui, sans-serif;
  --font: 'Manrope', 'Noto Sans Armenian', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --tabbar-h: 76px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #FFF8F3;
  --bg-2: #FFEFE6;
  --surface: rgba(30, 10, 40, 0.05);
  --surface-2: rgba(30, 10, 40, 0.09);
  --surface-solid: #FFFFFF;
  --line: rgba(30, 10, 40, 0.1);
  --text: #1C0F2B;
  --text-2: rgba(28, 15, 43, 0.7);
  --text-3: rgba(28, 15, 43, 0.45);
  --shadow: 0 20px 50px -24px rgba(80, 30, 60, .35);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 500 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
:lang(hy) body, body:lang(hy) { font-family: 'Noto Sans Armenian', var(--font); }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--apricot); outline-offset: 3px; border-radius: 8px; }
::selection { background: var(--coral); color: #fff; }

h1, h2, h3, .display { font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.08; margin: 0; }
h1 { font-size: clamp(32px, 7vw, 76px); font-weight: 900; }
h2 { font-size: clamp(24px, 4.5vw, 44px); font-weight: 700; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 14px; }
.tiny { font-size: 12px; letter-spacing: .02em; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- фон: аврора + зерно ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: radial-gradient(120% 80% at 50% -10%, var(--bg-2), var(--bg) 60%); }
.aurora i { --c: var(--coral); position: absolute; width: 80vmax; height: 80vmax; border-radius: 50%; opacity: .34;
  /* мягкое пятно рисуется градиентом: никаких filter: blur и mix-blend — их Safari пересчитывает каждый кадр */
  background: radial-gradient(closest-side, var(--c), transparent);
  will-change: transform; transform: translateZ(0); animation: drift 30s ease-in-out infinite alternate; }
:root[data-theme="light"] .aurora i { opacity: .16; }
.aurora i:nth-child(1) { --c: var(--coral); top: -35vmax; left: -25vmax; }
.aurora i:nth-child(2) { --c: var(--violet); top: 0; right: -35vmax; animation-duration: 36s; animation-delay: -6s; }
.aurora i:nth-child(3) { --c: var(--apricot); bottom: -45vmax; left: 0; animation-duration: 42s; animation-delay: -12s; opacity: .2; }
.aurora::after { content: ''; position: absolute; inset: 0; 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 baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ---------- кнопки ---------- */
.btn {
  --bg-btn: var(--surface-2);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border: 0; border-radius: 999px; overflow: hidden; isolation: isolate;
  background: var(--bg-btn); color: var(--text); font-weight: 700; font-size: 16px; text-decoration: none; white-space: nowrap;
  transition: transform .5s var(--spring), box-shadow .3s, opacity .2s, background .2s;
}
.btn:active { transform: scale(.95); transition-duration: .1s; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--grad); background-size: 160% 100%; color: #fff; box-shadow: var(--glow); }
.btn.primary::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%); transform: translateX(-120%); }
@media (hover: hover) { .btn.primary:hover::after { animation: shine 1.2s ease-in-out; } }
.btn.primary:hover { background-position: 100% 0; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.white { background: #fff; color: #1C0F2B; }
.btn.danger { background: rgba(255, 77, 106, .14); color: var(--danger); }
.btn.block { width: 100%; }
.btn.lg { min-height: 62px; font-size: 18px; padding: 0 30px; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn.icon { width: 46px; min-height: 46px; padding: 0; }
.btn .spinner { width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }

.iconbtn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface); position: relative; transition: transform .4s var(--spring), background .2s; }
.iconbtn:active { transform: scale(.88); }
.iconbtn .dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 3px var(--bg); animation: pulse 2s infinite; }

/* ---------- поверхности ---------- */
.glass { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.card.pad-lg { padding: 24px; }
.tile { transition: transform .5s var(--spring), background .2s; cursor: pointer; }
.tile:hover { background: var(--surface-2); }
.tile:active { transform: scale(.97); }
.divider { height: 1px; background: var(--line); margin: 8px 0; }

/* ---------- чипы и бейджи ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; transition: all .3s var(--ease-out); }
.chip.on { background: var(--text); color: var(--bg); border-color: transparent; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.paid, .badge.scheduled { color: var(--sky); background: rgba(60, 201, 255, .12); }
.badge.sent { color: var(--apricot); background: rgba(255, 154, 60, .14); }
.badge.opened { color: var(--violet); background: rgba(178, 107, 255, .15); }
.badge.redeemed { color: var(--mint); background: rgba(91, 227, 176, .14); }
.badge.expired, .badge.cancelled, .badge.refunded, .badge.pending_payment { color: var(--text-3); }

/* ---------- формы ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { font-size: 13px; font-weight: 700; color: var(--text-2); letter-spacing: .02em; }
.input, select.input, textarea.input {
  width: 100%; min-height: 54px; padding: 14px 18px; border-radius: 16px; border: 1.5px solid var(--line);
  background: var(--surface); outline: none; transition: border-color .2s, box-shadow .2s, background .2s; font-size: 16px;
}
textarea.input { resize: none; line-height: 1.5; }
.input:focus { border-color: var(--coral); box-shadow: 0 0 0 4px rgba(255, 94, 126, .18); background: var(--surface-2); }
.input::placeholder { color: var(--text-3); }
select.input option { background: var(--surface-solid); }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; z-index: 1; margin: 0; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-2); transition: background .3s; }
.switch i::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .45s var(--spring); box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.switch input:checked + i { background: var(--coral); }
.switch input:checked + i::after { transform: translateX(20px); }
.otp { display: flex; gap: 10px; justify-content: center; }
.otp input { width: 58px; height: 68px; text-align: center; font: 800 28px var(--font-display); border-radius: 18px; border: 1.5px solid var(--line); background: var(--surface); outline: none; transition: all .25s var(--spring); }
.otp input:focus { border-color: var(--coral); transform: translateY(-3px); box-shadow: 0 0 0 4px rgba(255, 94, 126, .18); }
.otp.shake { animation: shake .45s; }

/* ---------- тосты ---------- */
.toasts { position: fixed; left: 50%; top: max(16px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 14px 18px; border-radius: 18px; background: var(--surface-solid); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 600; animation: toastIn .6s var(--spring) both; pointer-events: auto; display: flex; gap: 10px; align-items: center; }
.toast.error { border-color: rgba(255, 77, 106, .5); }
.toast.out { animation: toastOut .35s ease-in forwards; }

/* ---------- нижний лист ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 500; background: rgba(5, 2, 10, .66); animation: fadeIn .3s both; }
.sheet { position: fixed; left: 50%; bottom: 0; z-index: 501; width: min(100%, 520px); max-height: 92dvh; overflow-y: auto; transform: translateX(-50%);
  background: var(--surface-solid); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 12px 20px calc(24px + env(safe-area-inset-bottom)); box-shadow: 0 -20px 60px rgba(0,0,0,.4);
  animation: sheetIn .6s var(--ease-out) both; }
.sheet::before { content: ''; display: block; width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 16px; }
.sheet.closing { animation: sheetOut .3s ease-in forwards; }
.sheet-backdrop.closing { animation: fadeOut .3s forwards; }

/* ---------- скелетоны ---------- */
.skel { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: skel 1.4s infinite; border-radius: var(--r); }

/* ---------- открытка ---------- */
.giftcard { position: relative; aspect-ratio: 4 / 5; border-radius: var(--r-lg); overflow: hidden; color: #fff; isolation: isolate;
  background: linear-gradient(145deg, var(--c1), var(--c2)); box-shadow: 0 30px 60px -25px var(--c1); }
.giftcard .pattern { position: absolute; inset: 0; z-index: -1; opacity: .35; }
.giftcard .emoji { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); font-size: 7em; filter: drop-shadow(0 18px 24px rgba(0,0,0,.25)); animation: floaty 4s ease-in-out infinite; }
.giftcard .shine { position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.22) 50%, transparent 65%); background-size: 250% 100%; animation: foil 6s ease-in-out infinite; }
.giftcard.mini .shine, .giftcard.mini .emoji { animation: none; }
.giftcard.mini .emoji { filter: none; }
.giftcard .label { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 18px; font: 700 15px/1.2 var(--font-display); background: linear-gradient(transparent, rgba(0,0,0,.25)); }
.giftcard.mini { border-radius: 18px; font-size: 7px; }
.giftcard.mini .label { display: none; }

/* ---------- анимации появления ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }
.stagger > * { animation: rise .7s var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: .03s } .stagger > *:nth-child(2) { animation-delay: .08s } .stagger > *:nth-child(3) { animation-delay: .13s }
.stagger > *:nth-child(4) { animation-delay: .18s } .stagger > *:nth-child(5) { animation-delay: .23s } .stagger > *:nth-child(6) { animation-delay: .28s }
.stagger > *:nth-child(7) { animation-delay: .33s } .stagger > *:nth-child(8) { animation-delay: .38s } .stagger > *:nth-child(n+9) { animation-delay: .42s }
.pop { animation: pop .7s var(--spring) both; }

::view-transition-old(root) { animation: vtOut .2s var(--ease-out) both; }
::view-transition-new(root) { animation: vtIn .32s var(--ease-out) both; }

@keyframes gradShift { 50% { background-position: 100% 0; } }
@keyframes drift { to { transform: translate(12vmax, 8vmax) scale(1.15); } }
@keyframes grain { 0%,100% { transform: translate(0,0) } 20% { transform: translate(-3%,2%) } 40% { transform: translate(2%,-3%) } 60% { transform: translate(-2%,3%) } 80% { transform: translate(3%,1%) } }
@keyframes shine { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.3); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-14px) scale(.95); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes sheetIn { from { transform: translate(-50%, 100%); } }
@keyframes sheetOut { to { transform: translate(-50%, 100%); } }
@keyframes skel { to { background-position: -200% 0; } }
@keyframes floaty { 50% { transform: translate(-50%, -56%) rotate(-4deg); } }
@keyframes foil { 0%, 100% { background-position: 120% 0; } 50% { background-position: -20% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
@keyframes vtOut { to { opacity: 0; transform: scale(.98); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(14px) scale(1.01); } }

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

/* ---------- аватар ---------- */
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font: 800 17px var(--font-display); color: #fff; background: var(--grad); flex: none; }
.avatar.xl { width: 84px; height: 84px; font-size: 32px; box-shadow: var(--glow); }

/* ---------- установка на экран «Домой» (PWA) ---------- */
.install-banner { position: fixed; left: 12px; right: 12px; bottom: calc(var(--bottom, 96px) + env(safe-area-inset-bottom)); z-index: 250; max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 22px; color: #fff;
  background: linear-gradient(120deg, rgba(255, 94, 126, .96), rgba(178, 107, 255, .96)); box-shadow: 0 20px 50px -14px rgba(178, 107, 255, .8);
  animation: bannerIn .7s var(--spring) both; }
.install-banner img { border-radius: 12px; box-shadow: 0 6px 16px rgba(0, 0, 0, .3); flex: none; }
.install-banner .txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.install-banner .txt b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.install-banner .tiny { opacity: .9; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.install-banner .btn { flex: none; padding: 0 14px; }
.install-banner .x { border: 0; background: rgba(255, 255, 255, .18); color: #fff; width: 30px; height: 30px; border-radius: 50%; flex: none; font-size: 13px; }
.install-banner.out { animation: bannerOut .35s ease-in both; }
.install-banner.top { bottom: auto; top: calc(12px + env(safe-area-inset-top)); animation-name: bannerInTop; }
.install-banner.top.out { animation: bannerOutTop .35s ease-in both; }
@keyframes bannerInTop { from { opacity: 0; transform: translateY(-40px) scale(.95); } }
@keyframes bannerOutTop { to { opacity: 0; transform: translateY(-40px) scale(.95); } }
.pwa-sheet { display: flex; flex-direction: column; gap: 18px; }
.pwa-head { display: flex; gap: 14px; align-items: center; }
.pwa-head img { border-radius: 16px; box-shadow: 0 10px 30px -8px rgba(255, 94, 126, .7); animation: pop .6s var(--spring) both; }
.pwa-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.pwa-steps li { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); animation: rise .6s var(--ease-out) var(--d) both; line-height: 1.45; }
.pwa-steps .n { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font: 800 13px var(--font-display); color: #fff; background: var(--grad); }
.pwa-steps .ic { display: inline-grid; place-items: center; width: 34px; height: 30px; margin: 0 3px; vertical-align: middle; border-radius: 9px; background: var(--surface-2); color: #3C9DFF; font-style: normal; }
.pwa-pointer { text-align: center; font-size: 30px; color: var(--coral); animation: pointDown 1.1s ease-in-out infinite; margin-top: 8px; }
@keyframes bannerIn { from { opacity: 0; transform: translateY(40px) scale(.95); } }
@keyframes bannerOut { to { opacity: 0; transform: translateY(40px) scale(.95); } }
@keyframes pointDown { 50% { transform: translateY(8px); } }
