:root {
  --bg: #07090e;
  --glass: rgba(22, 28, 40, .72);
  --glass-2: rgba(30, 38, 54, .7);
  --card: #10151f;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --text: #f1f4fa;
  --dim: #aeb8c8;
  --muted: #6c788c;
  --green: #22e584;
  --green-2: #0fb85e;
  --green-soft: rgba(34, 229, 132, .12);
  --gold: #ffc443;
  --gold-2: #ff9f1c;
  --blue: #6c9bff;
  --red: #ff5d6c;
  --r: 22px;
  --tabs-h: 74px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 0 16px calc(var(--tabs-h) + 28px + env(safe-area-inset-bottom));
  min-height: 100vh;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- живой фон ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg i { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: drift 18s ease-in-out infinite alternate; }
.bg .g1 { width: 360px; height: 360px; left: -120px; top: -140px; background: #0e7c4a; }
.bg .g2 { width: 300px; height: 300px; right: -140px; top: 120px; background: #1d3f9b; animation-delay: -6s; opacity: .4; }
.bg .g3 { width: 280px; height: 280px; left: 30%; bottom: -160px; background: #6b4a08; animation-delay: -12s; opacity: .28; }
@keyframes drift { to { transform: translate(40px, 30px) scale(1.15); } }

/* ---------- шапка ---------- */
.top { display: flex; align-items: center; gap: 12px; padding: 16px 2px 16px; }
.logo { width: 42px; height: 42px; border-radius: 13px; box-shadow: 0 8px 26px rgba(34, 229, 132, .35); }
.brand { flex: 1; min-width: 0; }
.brand b { display: block; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.brand span { display: block; font-size: 12.5px; color: var(--muted); }
.live {
  display: flex; align-items: center; gap: 7px; padding: 7px 12px 7px 10px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); font-size: 12.5px; font-weight: 700; color: var(--dim);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); white-space: nowrap;
}
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live.on { color: var(--green); }
.live.on i { background: var(--green); box-shadow: 0 0 0 0 rgba(34, 229, 132, .6); animation: ping 1.8s infinite; }
.live.wait { color: var(--gold); }
.live.wait i { background: var(--gold); }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(34, 229, 132, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 229, 132, 0); } }

/* ---------- общие блоки ---------- */
.view { animation: rise .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card {
  position: relative; background: var(--glass); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; margin-bottom: 12px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.h { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 4px 10px; }
.h b { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.h span { font-size: 12.5px; color: var(--muted); }
.card h3 { margin: 0 0 12px; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.note { margin: 10px 2px 0; font-size: 13px; color: var(--muted); }

/* ---------- герой ленты ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 26px; padding: 20px 18px 18px; margin-bottom: 12px;
  background:
    radial-gradient(260px 160px at 100% 0%, rgba(34, 229, 132, .28), transparent 70%),
    linear-gradient(160deg, rgba(20, 52, 38, .92), rgba(13, 19, 28, .92));
  border: 1px solid rgba(34, 229, 132, .22);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.hero.off { background: linear-gradient(160deg, rgba(36, 40, 52, .92), rgba(13, 17, 25, .92)); border-color: var(--line-2); }
.hero.wait { background: radial-gradient(260px 160px at 100% 0%, rgba(255, 196, 67, .22), transparent 70%), linear-gradient(160deg, rgba(48, 38, 14, .92), rgba(13, 17, 25, .92)); border-color: rgba(255, 196, 67, .25); }
.hero .row { display: flex; align-items: center; gap: 14px; }
.hero .t { flex: 1; min-width: 0; }
.hero .t b { display: block; font-size: 22px; font-weight: 850; letter-spacing: -.02em; }
.hero .t span { display: block; margin-top: 3px; font-size: 13.5px; color: var(--dim); }
.hero .filter {
  margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px;
}
.tag { padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, .07); font-size: 12.5px; font-weight: 700; color: var(--dim); }
.tag.g { background: var(--green-soft); color: var(--green); }

/* переключатель */
.switch { position: relative; width: 56px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, .14); transition: background .25s; }
.switch i::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; transition: transform .28s cubic-bezier(.3, 1.4, .5, 1); box-shadow: 0 3px 8px rgba(0, 0, 0, .35);
}
.switch input:checked + i { background: linear-gradient(90deg, var(--green-2), var(--green)); }
.switch input:checked + i::after { transform: translateX(24px); }

/* плитки */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 4px; }
.tile { padding: 12px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line); }
.tile b { display: block; font-size: 20px; font-weight: 850; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile span { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.tile.g b { color: var(--green); }

/* ---------- сделки ---------- */
.deal {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px 12px 10px 10px; margin-bottom: 8px; border-radius: 20px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: rise .4s cubic-bezier(.2, .8, .2, 1) both;
}
.deal:active { transform: scale(.985); }
.deal .pic {
  position: relative; width: 74px; height: 58px; flex: none; border-radius: 15px; overflow: hidden;
  background: radial-gradient(circle at 50% 65%, rgba(108, 155, 255, .32), rgba(108, 155, 255, .05) 70%), #0c1119;
  display: flex; align-items: center; justify-content: center;
}
.deal.t2 .pic { background: radial-gradient(circle at 50% 65%, rgba(34, 229, 132, .35), rgba(34, 229, 132, .05) 70%), #0c1119; }
.deal.t3 .pic { background: radial-gradient(circle at 50% 65%, rgba(255, 196, 67, .42), rgba(255, 159, 28, .06) 70%), #0c1119; }
.deal .pic img { width: 120%; height: 120%; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .55)); }
.deal .pic .ph { font-size: 22px; opacity: .6; }
.deal .mid { flex: 1; min-width: 0; }
.deal .l1 { display: flex; align-items: baseline; gap: 8px; }
.deal .pct { font-size: 17px; font-weight: 900; color: var(--blue); letter-spacing: -.01em; }
.deal.t2 .pct { color: var(--green); }
.deal.t3 .pct { color: var(--gold); }
.deal .price { font-size: 16px; font-weight: 800; }
.deal .nm { margin-top: 1px; font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal .nm i { font-style: normal; font-weight: 600; color: var(--muted); }
.deal .l3 { margin-top: 2px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal .l3 b { color: var(--dim); font-weight: 700; }
.deal .go { width: 34px; height: 34px; flex: none; border-radius: 12px; background: rgba(255, 255, 255, .07); display: flex; align-items: center; justify-content: center; }
.deal .go svg { width: 16px; height: 16px; stroke: var(--dim); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* радар для пустой ленты */
.radar { position: relative; width: 150px; height: 150px; margin: 18px auto 16px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 229, 132, .12) 0 1px, transparent 2px) 0 0 / 100% 100%,
    repeating-radial-gradient(circle, transparent 0 24px, rgba(34, 229, 132, .14) 25px 26px);
  border: 1px solid rgba(34, 229, 132, .2); overflow: hidden; }
.radar::before { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(34, 229, 132, .5), rgba(34, 229, 132, 0) 70deg, transparent 360deg); animation: sweep 2.6s linear infinite; }
.radar::after { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 16px var(--green); }
@keyframes sweep { to { transform: rotate(360deg); } }
.empty-feed { text-align: center; padding: 6px 16px 20px; }
.empty-feed b { display: block; font-size: 17px; }
.empty-feed span { display: block; margin-top: 6px; font-size: 13.5px; color: var(--muted); }

/* ---------- пресеты ---------- */
.presets { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px 4px; padding: 2px 16px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.presets::-webkit-scrollbar { display: none; }
.preset {
  flex: none; width: 168px; scroll-snap-align: start; text-align: left; padding: 14px; border-radius: 20px;
  background: var(--glass); border: 1px solid var(--line); position: relative; overflow: hidden;
}
.preset::before { content: ""; position: absolute; inset: 0; opacity: .9; background: var(--pg); pointer-events: none; }
.preset > * { position: relative; }
.preset .em { font-size: 26px; line-height: 1; }
.preset b { display: block; margin-top: 10px; font-size: 15px; font-weight: 800; }
.preset span { display: block; margin-top: 4px; font-size: 12px; line-height: 1.3; color: var(--dim); }
.preset:active { transform: scale(.97); }

/* ---------- поля ---------- */
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: end; }
.field label { display: block; font-size: 12.5px; color: var(--dim); margin: 0 0 7px 2px; }
.gap { height: 14px; }
.input {
  display: flex; align-items: center; gap: 6px; height: 48px; padding: 0 14px;
  background: rgba(0, 0, 0, .28); border: 1px solid var(--line-2); border-radius: 14px; transition: border-color .2s, box-shadow .2s;
}
.input:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px rgba(34, 229, 132, .12); }
.input span { color: var(--muted); font-weight: 800; }
.input input { flex: 1; min-width: 0; width: 100%; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; font-weight: 700; }
.error { margin-top: 10px; font-size: 13px; color: var(--red); display: none; }
.error.show { display: block; }

.slider .head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 2px 6px; }
.slider .head label { font-size: 13px; color: var(--dim); }
.slider .head b { font-size: 16px; font-weight: 850; color: var(--green); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--green-2), var(--green) var(--p, 0%), rgba(255, 255, 255, .12) var(--p, 0%)); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 5px rgba(34, 229, 132, .25), 0 3px 10px rgba(0, 0, 0, .45);
}
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .12); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--green); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line-2); background: rgba(0, 0, 0, .2); color: var(--dim);
  border-radius: 999px; padding: 9px 14px; font-size: 14px; font-weight: 700; transition: all .18s;
}
.chip.on { background: var(--green-soft); border-color: rgba(34, 229, 132, .55); color: var(--green); box-shadow: 0 0 18px rgba(34, 229, 132, .12); }
.chip:active { transform: scale(.95); }

.save {
  position: sticky; bottom: calc(var(--tabs-h) + 18px + env(safe-area-inset-bottom)); width: 100%; height: 52px; border: 0; border-radius: 16px; margin-top: 6px;
  background: linear-gradient(180deg, var(--green), var(--green-2)); color: #03230f; font-size: 16px; font-weight: 850;
  box-shadow: 0 12px 34px rgba(34, 229, 132, .4); display: none;
}
.save.show { display: block; }
.save:disabled { opacity: .4; }

/* ---------- профиль ---------- */
.me { display: flex; align-items: center; gap: 14px; }
.me .av { width: 56px; height: 56px; border-radius: 18px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: linear-gradient(135deg, rgba(34, 229, 132, .35), rgba(108, 155, 255, .25)); border: 1px solid var(--line-2); }
.me.founder .av { background: linear-gradient(135deg, #ffd56b, #ff9f1c); color: #3a2200; box-shadow: 0 10px 30px rgba(255, 159, 28, .35); }
.me b { display: block; font-size: 18px; font-weight: 850; }
.me span { display: block; margin-top: 2px; font-size: 13px; color: var(--dim); }
.badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 8px 12px; border-radius: 12px; font-size: 13px; font-weight: 750;
  background: linear-gradient(90deg, rgba(255, 196, 67, .18), rgba(255, 159, 28, .08)); color: var(--gold); border: 1px solid rgba(255, 196, 67, .25); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 11px 2px; border-top: 1px solid var(--line); font-size: 14px; }
.kv:first-of-type { border-top: 0; }
.kv span { color: var(--dim); }
.kv b { font-weight: 700; text-align: right; }
.list { margin: 0; padding: 0; list-style: none; }
.list li { position: relative; padding: 6px 0 6px 26px; font-size: 14px; color: var(--dim); }
.list li::before { content: "✓"; position: absolute; left: 2px; top: 5px; color: var(--green); font-weight: 900; }
.list.no li::before { content: "✕"; color: var(--red); }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 50px; border-radius: 16px; margin-top: 10px;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--line-2); font-size: 15px; font-weight: 750;
}
.btn.danger { background: rgba(255, 93, 108, .1); border-color: rgba(255, 93, 108, .35); color: #ff8a95; }
.btn:active { transform: scale(.985); }
.foot { margin: 18px 4px 0; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.5; }

/* ---------- нижняя панель ---------- */
.tabs {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); height: var(--tabs-h); z-index: 20;
  display: grid; grid-template-columns: repeat(3, 1fr); padding: 7px; border-radius: 26px;
  background: rgba(16, 21, 31, .78); border: 1px solid var(--line-2);
  backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
}
.tabs[hidden] { display: none; }
.tabs button { border: 0; background: transparent; border-radius: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 11.5px; font-weight: 750; transition: all .2s; }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.tabs button:first-child svg { fill: currentColor; stroke: none; }
.tabs button.on { color: var(--green); background: var(--green-soft); }

/* ---------- лист, тост, загрузка ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 78vh; overflow: auto;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0;
  background: #121824; border-top: 1px solid var(--line-2); animation: up .3s cubic-bezier(.2, .8, .2, 1);
}
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .2); margin: 0 auto 14px; }
.sheet h2 { margin: 0 0 6px; font-size: 19px; }
.sheet p { margin: 0 0 12px; font-size: 13.5px; color: var(--dim); }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 26px + env(safe-area-inset-bottom)); z-index: 40;
  transform: translate(-50%, 14px); max-width: calc(100% - 40px);
  padding: 12px 16px; border-radius: 14px; background: rgba(32, 42, 58, .95); border: 1px solid var(--line-2);
  font-size: 14px; font-weight: 650; text-align: center;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.loading { padding: 120px 0; }
.spinner { width: 34px; height: 34px; margin: 0 auto; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .1); border-top-color: var(--green); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 90px 22px; text-align: center; color: var(--dim); }
.empty b { display: block; font-size: 20px; color: var(--text); margin-bottom: 8px; }
