:root {
  --bg: #0b0614;
  --card: rgba(255, 255, 255, .045);
  --card-b: rgba(196, 167, 255, .13);
  --text: #f4effc;
  --muted: #a99cc4;
  --dim: #75689a;
  --a1: #8b5cf6;
  --a2: #d946ef;
  --ok: #34d399;
  --r: 22px;
  color-scheme: dark;
}

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

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { overflow-x: hidden; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* фон: тёмный градиент и медленно плавающие пурпурные пятна */
.bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background: radial-gradient(120% 70% at 50% -10%, #2b1153 0%, var(--bg) 62%);
}
.blob { position: absolute; border-radius: 50%; filter: blur(70px); animation: float 18s ease-in-out infinite; }
.b1 { width: 320px; height: 320px; background: #7c3aed; top: -130px; left: -90px; opacity: .5; }
.b2 { width: 260px; height: 260px; background: #c026d3; top: 220px; right: -130px; opacity: .3; animation-delay: -6s; }
.b3 { width: 300px; height: 300px; background: #4f46e5; bottom: -160px; left: 15%; opacity: .25; animation-delay: -12s; }
@keyframes float { 50% { transform: translate(30px, 40px) scale(1.1); } }

main {
  max-width: 520px; margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom));
}
.screen { animation: rise .5s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.center {
  min-height: 82vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 14px;
}

/* шапка */
.top { display: flex; align-items: center; gap: 12px; margin: 4px 2px 18px; }
.avatar {
  width: 46px; height: 46px; border-radius: 15px; flex: none; overflow: hidden;
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
  background: linear-gradient(135deg, var(--a1), var(--a2));
  box-shadow: 0 8px 22px -8px rgba(168, 85, 247, .7);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.hello { font-weight: 650; font-size: 17px; }
.sub { color: var(--muted); font-size: 13px; }

/* карточки */
.card {
  position: relative; margin-bottom: 14px; padding: 18px;
  background: var(--card); border: 1px solid var(--card-b); border-radius: var(--r);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.hero {
  overflow: hidden; padding: 22px 20px 20px;
  background: linear-gradient(150deg, rgba(139, 92, 246, .3), rgba(217, 70, 239, .12) 55%, rgba(255, 255, 255, .03));
  border-color: rgba(196, 167, 255, .24);
}
.hero::after {
  content: ""; position: absolute; width: 230px; height: 230px; right: -80px; top: -100px; border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 70, 239, .45), transparent 70%); pointer-events: none;
}
.label { color: var(--muted); font-size: 13px; letter-spacing: .02em; }
.big {
  margin: 4px 0 14px; font-size: 58px; font-weight: 800; line-height: 1.05; letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #fff 25%, #e9d5ff 60%, #f0abfc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08);
  font-size: 12.5px; color: #ddd3f3;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.off { background: var(--dim); box-shadow: none; }
.hero-btn { position: relative; z-index: 1; width: 100%; margin-top: 18px; }

h2 {
  margin: 26px 4px 10px; font-size: 12.5px; font-weight: 650; color: var(--muted);
  text-transform: uppercase; letter-spacing: .09em;
}
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.title { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 16px; }
.title svg { color: #c4b5fd; }
.hint { margin-top: 12px; color: var(--muted); font-size: 12.5px; }

/* кнопки */
.btn {
  appearance: none; border: 0; cursor: pointer; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 16px; border-radius: 15px;
  transition: transform .15s ease, opacity .15s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; pointer-events: none; }
.primary {
  background: linear-gradient(135deg, var(--a1), var(--a2));
  box-shadow: 0 12px 26px -12px rgba(192, 38, 211, .85), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.ghost { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .1); }
.icon { flex: none; width: 50px; padding: 0; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .09); }
.grow { flex: 1; min-width: 0; }
.wide { width: 100%; }

/* ключ */
.keybox {
  margin: 14px 0 12px; padding: 14px; border-radius: 14px;
  background: rgba(8, 4, 16, .55); border: 1px dashed rgba(196, 167, 255, .28);
  font: 13.5px/1.5 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .02em;
  color: #e9e1fb; word-break: break-all; user-select: all;
}
.actions { display: flex; gap: 8px; }
.empty { text-align: center; padding: 8px 0 2px; }
.empty .ic {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center;
  background: rgba(139, 92, 246, .16); color: #c4b5fd;
}
.empty .btn { margin-top: 16px; }

.pill { font-size: 11.5px; font-weight: 650; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.pill.ok { color: #6ee7b7; background: rgba(52, 211, 153, .12); }
.pill.wait { color: #fcd34d; background: rgba(251, 191, 36, .12); }
.pill.bad { color: #fca5a5; background: rgba(248, 113, 113, .12); }

/* пополнение */
.qty { display: flex; align-items: center; gap: 10px; }
.step { height: 50px; border-radius: 16px; }
.qty-field { flex: 1; min-width: 0; text-align: center; }
.qty-field input {
  width: 100%; background: none; border: 0; outline: none; text-align: center; color: var(--text);
  font-family: inherit; font-size: 40px; font-weight: 800; line-height: 1.1;
  letter-spacing: -.03em; font-variant-numeric: tabular-nums;
  caret-color: #e879f9;
}
.qty-unit { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 14px 0 6px; background: none; --p: 0%; }
.slider::-webkit-slider-runnable-track {
  height: 6px; border-radius: 6px;
  background: linear-gradient(90deg, var(--a1), var(--a2)) 0 / var(--p) 100% no-repeat, rgba(255, 255, 255, .1);
}
.slider::-moz-range-track { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .1); }
.slider::-moz-range-progress { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--a1), var(--a2)); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%;
  background: #fff; border: 4px solid #c084fc; box-shadow: 0 4px 14px rgba(192, 38, 211, .6);
}
.slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 4px solid #c084fc; box-shadow: 0 4px 14px rgba(192, 38, 211, .6);
}

.presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.preset {
  position: relative; cursor: pointer; padding: 10px 6px; border-radius: 14px; text-align: center;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08);
  transition: transform .15s, border-color .2s, background .2s;
}
.preset:active { transform: scale(.96); }
.preset.on { border-color: rgba(217, 70, 239, .6); background: linear-gradient(160deg, rgba(168, 85, 247, .25), rgba(217, 70, 239, .1)); }
.preset .n { font-weight: 750; font-size: 16px; }
.preset .p { color: var(--muted); font-size: 11.5px; }
.preset .off { color: #f0abfc; font-weight: 700; }

.total {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin: 18px 0 14px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .07);
}
.rate { margin-top: 3px; font-size: 13px; color: #ddd3f3; }
.rate .off { margin-left: 6px; }
.sum-big {
  font-size: 32px; font-weight: 800; letter-spacing: -.03em; white-space: nowrap; font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #fff 30%, #f0abfc); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nudge {
  margin: -4px 0 14px; padding: 10px 12px; border-radius: 12px; font-size: 13px; cursor: pointer;
  background: rgba(217, 70, 239, .1); border: 1px solid rgba(217, 70, 239, .25); color: #f5d0fe;
}
.nudge.warn { cursor: default; background: rgba(251, 191, 36, .08); border-color: rgba(251, 191, 36, .25); color: #fde68a; }

/* история */
.list { padding: 4px 16px; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.item:last-child { border-bottom: 0; }
.item .ic {
  flex: none; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center;
  background: rgba(139, 92, 246, .15); color: #c4b5fd;
}
.item .mid { flex: 1; min-width: 0; }
.item .t { font-weight: 600; white-space: nowrap; }
.item .d { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .d { color: var(--dim); font-size: 12px; }
.item .r { margin-left: auto; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.item .sum { font-weight: 600; font-size: 14px; }
.list .empty { padding: 18px 0; color: var(--dim); font-size: 13.5px; }

/* как это работает */
.intro { display: flex; gap: 14px; align-items: flex-start; }
.intro p { margin-top: 6px; color: var(--muted); font-size: 13.5px; }
.intro-ic {
  flex: none; width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--a1), var(--a2)); box-shadow: 0 10px 24px -10px rgba(192, 38, 211, .8);
}
.how-steps { padding: 6px 18px; }
.how-step { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.how-step:last-child { border-bottom: 0; }
.how-step .num {
  flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; color: #f5d0fe;
  background: rgba(217, 70, 239, .14); border: 1px solid rgba(217, 70, 239, .3);
}
.how-step .t { font-weight: 650; }
.how-step .d { margin-top: 2px; color: var(--muted); font-size: 13px; }
.btn.small { margin-top: 10px; padding: 9px 14px; border-radius: 12px; font-size: 13.5px; text-decoration: none; }
.faq { padding: 4px 18px; }
.faq details { border-bottom: 1px solid rgba(255, 255, 255, .06); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  list-style: none; cursor: pointer; padding: 14px 24px 14px 0; position: relative; font-weight: 600; font-size: 14.5px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 4px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid #c4b5fd; border-bottom: 2px solid #c4b5fd; transform: rotate(45deg); transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq details p { padding: 0 0 14px; color: var(--muted); font-size: 13.5px; }

.foot { margin: 20px 12px 0; text-align: center; color: var(--dim); font-size: 12px; }

/* экран подписки */
.gate-ic {
  width: 92px; height: 92px; margin-bottom: 8px; border-radius: 30px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--a1), var(--a2));
  box-shadow: 0 22px 50px -16px rgba(192, 38, 211, .85);
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: translateY(-4px); box-shadow: 0 30px 60px -18px rgba(192, 38, 211, .95); } }
.gate h1 { font-size: 25px; letter-spacing: -.02em; }
.gate p { max-width: 300px; margin-bottom: 8px; color: var(--muted); }
.gate .btn { width: 100%; max-width: 320px; }

.spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(196, 167, 255, .18); border-top-color: #c084fc;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* нижняя шторка и тост */
.sheet {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(5, 2, 10, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade .2s;
}
.panel {
  width: 100%; max-width: 520px; padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #1d1032, #120a21);
  border: 1px solid var(--card-b); border-bottom: 0; border-radius: 28px 28px 0 0;
  animation: up .32s cubic-bezier(.2, .8, .2, 1);
}
.grab { width: 40px; height: 4px; margin: 0 auto 18px; border-radius: 4px; background: rgba(255, 255, 255, .2); }
.sheet-n { margin-top: 4px; font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.sheet-p { font-size: 18px; font-weight: 600; color: #e9d5ff; }
.sheet-actions { display: grid; gap: 8px; margin-top: 18px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 30;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 15px;
  background: rgba(32, 19, 54, .94); border: 1px solid var(--card-b);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 14px; font-weight: 550; text-align: center;
  opacity: 0; transform: translate(-50%, 30px); pointer-events: none;
  transition: .3s cubic-bezier(.2, .8, .2, 1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 360px) {
  main { padding-left: 12px; padding-right: 12px; }
  .big { font-size: 48px; }
  .qty-field input { font-size: 34px; }
  .sum-big { font-size: 28px; }
  .preset .p { font-size: 10.5px; }
  .icon { width: 44px; }
  .actions .btn.grow { padding: 14px 10px; }
}
