/* Polymarket Radar — дизайн-система v2 (dark-first, фиксированная тёмная тема).
   Токены: docs/ui_design_research.md §3. НЕ берём цвета из tg-theme-* —
   светлая тема Telegram не должна ломать вид. */

:root {
  color-scheme: dark;

  /* Поверхности: 4 уровня elevation, шаг светлости ~5–8% */
  --bg: #0B0E13;
  --surface: #131926;
  --elevated: #1B2333;
  --overlay: #232D40;

  /* Текст */
  --text: #E9EDF2;
  --hint: #8B95A3;
  --hint-strong: #AAB4C0;

  /* Акцент и семантика */
  --accent: #35E0A1;
  --accent-ink: #06130D; /* тёмный текст на primary-кнопке (WCAG 10.3:1) */
  --btn: #2FD891;
  --btn-press: #26BC7E;
  --accent-dim: rgba(53, 224, 161, 0.13);
  --green: #35E0A1;
  --red: #FF6B6B;
  --red-dim: rgba(255, 107, 107, 0.12);
  --amber: #F0B64C;
  --amber-dim: rgba(240, 182, 76, 0.12);
  --link: #5B83FF; /* осветлённый Poly Blue */
  --poly: #5B83FF;

  /* Линии, радиусы, тени */
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --radius-lg: 20px;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.40);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, "SF Pro Display", "Segoe UI", Roboto, system-ui, sans-serif;
  background:
    radial-gradient(ellipse 120% 60% at 50% -10%, rgba(53, 224, 161, 0.10), transparent 55%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Клавиатурная/внешняя доступность */
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  z-index: 5;
  border-bottom: 1px solid transparent;
}

.topbar-text { flex: 1; min-width: 0; }
.topbar h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-sub {
  font-size: 12px;
  color: var(--hint);
  margin-top: 1px;
}
.topbar-sub.hidden { display: none; }

.icon-btn {
  background: var(--elevated);
  border: 1px solid var(--line);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 17px;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:active { opacity: 0.75; }

.badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(53, 224, 161, 0.28);
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}
.badge.badge-leg {
  background: rgba(240, 182, 76, 0.16);
  color: var(--amber);
  border-color: rgba(240, 182, 76, 0.45);
  box-shadow: 0 0 0 1px rgba(240, 182, 76, 0.2);
}
/* Legendary / Старт: лёгкая «рамка» вокруг shell */
body.tier-legendary .topbar {
  box-shadow: inset 0 -1px 0 rgba(240, 182, 76, 0.28);
}
body.tier-legendary .tabbar {
  border-top-color: rgba(240, 182, 76, 0.22);
}
/* Админ: magenta/розовый акцент (не ломает dark canvas) */
body.tier-admin {
  --admin-pink: #e85aad;
  --admin-pink-dim: rgba(232, 90, 173, 0.16);
}
body.tier-admin .topbar {
  background: linear-gradient(180deg, rgba(232, 90, 173, 0.18), transparent 85%),
    var(--bg);
  box-shadow: inset 0 -1px 0 rgba(232, 90, 173, 0.35);
}
body.tier-admin .tabbar {
  border-top-color: rgba(232, 90, 173, 0.35);
  background: color-mix(in srgb, var(--bg) 88%, #e85aad 12%);
}
body.tier-admin .hero {
  background: linear-gradient(160deg, rgba(232, 90, 173, 0.14), transparent 60%);
  border-radius: var(--radius);
}
.badge.badge-admin {
  background: var(--admin-pink-dim, rgba(232, 90, 173, 0.16));
  color: #ff8fd0;
  border-color: rgba(232, 90, 173, 0.45);
}
.au-status.admin {
  background: rgba(232, 90, 173, 0.16);
  color: #ff8fd0;
}
.au-status.gold {
  background: rgba(240, 182, 76, 0.16);
  color: var(--amber);
}
.plan-card.legendary {
  background:
    linear-gradient(180deg, rgba(240, 182, 76, 0.06), transparent 48%),
    var(--surface);
}
.badge.badge-trial {
  background: rgba(91, 131, 255, 0.14);
  color: var(--poly);
  border-color: rgba(91, 131, 255, 0.30);
}

main {
  flex: 1;
  padding: 8px 16px calc(96px + env(safe-area-inset-bottom));
}

.hidden { display: none !important; }

/* --- hero / home --- */
.hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, #14261F 0%, #0F1611 60%, #101A14 100%);
  border: 1px solid rgba(53, 224, 161, 0.18);
  border-radius: var(--radius-lg);
  padding: 20px 18px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  right: -40px;
  top: -50px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(53, 224, 161, 0.20), transparent 70%);
  pointer-events: none;
}
.hero h2 {
  position: relative;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  line-height: 1.2;
}
.hero p {
  position: relative;
  font-size: 13.5px;
  color: rgba(233, 237, 242, 0.78);
  line-height: 1.5;
  max-width: 34ch;
}
.hero .access-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: rgba(233, 237, 242, 0.9);
}
.hero .access-pill.ok { color: var(--green); border-color: rgba(53, 224, 161, 0.3); }
.hero .access-pill.warn { color: var(--amber); border-color: rgba(240, 182, 76, 0.35); }

.quick-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.quick {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s;
}
.quick:active { transform: scale(0.97); background: rgba(53, 224, 161, 0.12); }
.quick .q-ico {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.quick span.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: rgba(233, 237, 242, 0.9);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 2px 10px;
}
.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.link-btn {
  border: none;
  background: none;
  color: var(--link);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

/* --- cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  transition: transform 0.08s, border-color 0.15s;
}
.card.tappable {
  cursor: pointer;
}
.card.tappable:active {
  transform: scale(0.985);
  border-color: rgba(53, 224, 161, 0.28);
}
.card.static { cursor: default; }
.card h3 {
  font-size: 15px;
  font-weight: 650;
  margin-bottom: 4px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.card .muted { font-size: 12px; color: var(--hint); line-height: 1.4; }

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.row + .row { margin-top: 8px; }

.stat { text-align: right; flex-shrink: 0; }
.stat b { font-size: 15px; display: block; letter-spacing: -0.02em; }
.stat span { font-size: 11px; color: var(--hint-strong); }

.pos { color: var(--green); }
.neg { color: var(--red); }
.mono {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  color: var(--hint);
  font-size: 12px;
  word-break: break-all;
}

/* Цифры данных — ровные колонки, вёрстка не прыгает при обновлении */
.stat b,
.metric-grid b,
.pill,
.side-tag,
.price-pills,
.outcome-row b,
b.num {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(145deg, #26BC7E, #14261F);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(53, 224, 161, 0.25);
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chev {
  color: var(--hint);
  font-size: 16px;
  opacity: 0.55;
  flex-shrink: 0;
}

.side-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
}
.side-tag.pos { background: var(--accent-dim); }
.side-tag.neg { background: var(--red-dim); }

.price-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill {
  font-size: 11px;
  font-weight: 650;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  color: var(--hint);
}
.pill.yes { color: var(--green); background: var(--accent-dim); }
.pill.no { color: var(--red); background: var(--red-dim); }

/* Флаг «подозрительный винрейт» (WR>90% — возможен фарм) */
.wr-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--amber);
  background: var(--amber-dim);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
}

/* --- buttons --- */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--btn);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  margin-top: 12px;
  letter-spacing: -0.01em;
  transition: background 0.12s, transform 0.08s, opacity 0.12s;
}
.btn:active { background: var(--btn-press); transform: scale(0.98); }
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn:disabled:active { background: var(--btn); transform: none; }
.btn.secondary {
  background: var(--elevated);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn.secondary:active { background: var(--overlay); }
.btn.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px dashed rgba(53, 224, 161, 0.35);
}
.btn.ghost:active { background: var(--accent-dim); }
.btn.small {
  width: auto;
  padding: 8px 12px;
  font-size: 12px;
  margin-top: 0;
  flex-shrink: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.metric-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
.metric-grid div {
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
}
.metric-grid b {
  display: block;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.metric-grid span {
  display: block;
  margin-top: 3px;
  color: var(--hint-strong);
  font-size: 11px;
}

.compare-banner {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(53, 224, 161, 0.08);
  border: 1px solid rgba(53, 224, 161, 0.25);
  font-size: 13px;
}
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.compare-head {
  text-align: center;
  font-size: 12px;
  font-weight: 650;
  margin: 8px 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compare-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
  font-size: 13px;
}
.compare-row .lbl {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--hint-strong);
  margin-top: 8px;
}
.compare-cell {
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  min-width: 0;
}
.compare-cell b { display: block; font-size: 15px; }
.compare-cell .muted { font-size: 11px; margin-top: 2px; }
.sparkline {
  display: block;
  margin: 8px 0 4px;
  background: var(--elevated);
  border-radius: var(--radius-sm);
}

.trade-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  margin: 8px 0 4px;
  border: 1px solid var(--line);
  display: block;
}

.outcome-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.outcome-row:last-child { border-bottom: 0; }

.status-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--elevated);
}

/* --- chips + segmented control --- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--hint);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.chip.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(53, 224, 161, 0.35);
}

/* Сегмент-контрол: группа чипов на elevated-подложке (экран «Топ») */
.seg-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.seg-row::-webkit-scrollbar { display: none; }
.segment {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  padding: 3px;
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}
.segment .chip {
  border: none;
  background: transparent;
  padding: 7px 13px;
}
.segment .chip.active {
  background: var(--accent-dim);
  border: none;
}

/* --- search --- */
.searchbox { margin-bottom: 12px; }
.searchbox input {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.searchbox input:focus {
  border-color: rgba(53, 224, 161, 0.4);
}
.searchbox input::placeholder { color: var(--hint); }

/* --- states --- */
.empty, .error-box, .loading {
  text-align: center;
  padding: 36px 18px;
  color: var(--hint);
  font-size: 14px;
  line-height: 1.55;
}
.empty-card, .error-card {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px 18px;
  text-align: center;
  margin-bottom: 10px;
}
.empty-card p, .error-card p {
  color: var(--hint);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 4px;
}
.empty-card .title, .error-card .title {
  color: var(--text);
  font-weight: 650;
  font-size: 15px;
  margin-bottom: 6px;
}
.error-box, .error-card .title { color: var(--red); }
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--elevated);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- shimmer-скелетоны (списки/карточки вместо спиннера) --- */
.sk {
  display: block;
  background: linear-gradient(90deg, var(--elevated) 25%, var(--overlay) 50%, var(--elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
.sk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.sk-circle { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; }
.sk-grow { flex: 1; min-width: 0; display: block; }
.sk-col { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.sk-bar { height: 12px; margin: 4px 0; }
.sk-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.sk-pills { display: flex; gap: 6px; margin-top: 10px; }
.sk-pill { width: 64px; height: 20px; border-radius: var(--radius-pill); }
.sk-hero { height: 170px; border-radius: var(--radius-lg); margin-bottom: 14px; }
.sk-chips { display: flex; gap: 8px; padding: 2px 0 10px; }
.sk-chips .sk { width: 76px; height: 32px; border-radius: var(--radius-pill); }

.paywall {
  text-align: left;
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}
.paywall .hero h2 { font-size: 20px; }
.paywall .terms {
  position: relative;
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(233, 237, 242, 0.62);
  max-width: none;
}
.paywall-sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  max-width: 480px;
  margin: 0 auto;
  padding: 10px 14px;
  z-index: 12;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg) 92%, transparent) 28%, var(--bg));
  pointer-events: none;
}
.paywall-sticky .btn {
  pointer-events: auto;
  width: 100%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.plan-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 4px;
}
.plan-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.plan-card.highlight {
  border-color: rgba(53, 224, 161, 0.35);
  box-shadow: 0 0 0 1px rgba(53, 224, 161, 0.12);
}
.plan-card.legendary {
  border-color: rgba(240, 182, 76, 0.35);
  background:
    linear-gradient(180deg, rgba(240, 182, 76, 0.06), transparent 48%),
    var(--surface);
}
.plan-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.plan-top b { font-size: 15px; }
.plan-tag {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-dim);
  color: var(--accent);
}
.plan-tag.gold {
  background: rgba(240, 182, 76, 0.16);
  color: var(--amber);
}
.plan-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
}
.plan-price b {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums lining-nums;
}
.plan-price span { color: var(--hint-strong); font-size: 13px; }
.plan-for {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--hint-strong);
}
.plan-blurb {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--hint);
}
.plan-trust-mini {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--hint);
}
.plan-card.plan-hero {
  border-color: rgba(53, 224, 161, 0.4);
  box-shadow: 0 0 0 1px rgba(53, 224, 161, 0.1);
}
.why-radar {
  margin-top: 12px;
}
.plan-perks {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.plan-perks li {
  font-size: 12px;
  line-height: 1.35;
  color: var(--hint-strong);
  padding-left: 12px;
  position: relative;
}
.plan-perks li::before {
  content: "·";
  position: absolute;
  left: 2px;
  color: var(--accent, #7dffa6);
}
.plan-card .btn { margin-top: 12px; }

.browser-fallback {
  margin-top: 24px;
}
.browser-fallback .terms { margin-top: 16px; }
body.no-tg .topbar { border-bottom: 1px solid var(--line); }
body.no-tg main { padding-bottom: 32px; }

.feature-list {
  list-style: none;
  margin-top: 10px;
}
.feature-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.4;
}
.feature-list li:last-child { border-bottom: 0; }
.feature-list .f-ico {
  font-size: 15px;
  line-height: 1.3;
  flex-shrink: 0;
}
.feature-list .dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.trust-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--hint-strong);
  margin: 12px 2px 0;
}

/* --- M18: whale teaser + alerts log --- */
.whale-card {
  padding: 11px 14px;
}
.whale-card h3 {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Sprint Q: size badges on whale cards */
.whale-size {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  color: var(--hint-strong);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.whale-size.whale { color: var(--text); }
.whale-size.large {
  color: var(--green);
  background: var(--accent-dim);
  border-color: rgba(53, 224, 161, 0.22);
}
.whale-size.mega {
  color: #f0c674;
  background: rgba(240, 198, 116, 0.12);
  border-color: rgba(240, 198, 116, 0.28);
}
.whale-open-hint {
  font-size: 11px;
  margin-left: auto;
  margin-right: 4px;
}
#whale-tier-chips {
  margin: 0 0 8px;
}
.empty-muted {
  margin: 0 2px 12px;
  font-size: 12.5px;
}
.notif-row {
  padding: 10px 14px;
}
.notif-kind {
  font-size: 13px;
  font-weight: 600;
}
.alert-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.alert-status.on { color: var(--green); }
.alert-status.off { color: var(--amber); }
.alert-item .alert-sim {
  margin-top: 10px;
  width: 100%;
}
.demo-cta-row {
  margin-top: 12px;
}

/* --- tabbar --- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  background: color-mix(in srgb, var(--overlay) 82%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 6px 2px calc(8px + env(safe-area-inset-bottom));
  z-index: 10;
}
.tab {
  flex: 1;
  border: none;
  background: none;
  color: var(--hint);
  padding: 6px 0 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
}
.tab-ico {
  display: flex;
  line-height: 1;
}
.tab-ico svg {
  width: 21px;
  height: 21px;
  display: block;
}
.tab span:last-child {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tab.active { color: var(--accent); }

.toast {
  position: fixed;
  bottom: calc(78px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--overlay) 92%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 550;
  z-index: 50;
  max-width: calc(100% - 32px);
  box-shadow: var(--shadow);
  animation: fadein 0.2s ease;
}
@keyframes fadein {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .card.tappable, .quick, .btn, .toast { transition: none; animation: none; }
  .spinner { animation-duration: 1.4s; }
  .sk { animation: none; }
}

/* ================= M13: позиции, watchlist, алерты, настройки, онбординг, админка ================= */

/* пилюля доступа на home — кликабельная (ведёт в settings) */
button.access-pill { cursor: pointer; font-family: inherit; }

/* quick-grid: SVG-иконки вместо текстовых заглушек */
.quick .q-ico { display: flex; justify-content: center; }
.quick .q-ico svg { width: 22px; height: 22px; display: block; }

/* график: скелетон фиксированной высоты — без layout shift */
.sk-chart { height: 120px; border-radius: var(--radius-sm); }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chart-body { margin-top: 10px; }
.seg-compact .chip { padding: 6px 11px; font-size: 12px; }

/* строка кнопок рядом (Следить / Алерт) */
.btn-row { display: flex; gap: 8px; margin-top: 12px; }
.btn-row .btn { margin-top: 0; flex: 1; }
.btn.watch-on {
  border-color: rgba(53, 224, 161, 0.45);
  color: var(--accent);
  background: var(--accent-dim);
}

/* destructive (отписка, отнять доступ): красный текст на приглушённой подложке */
.btn.danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255, 107, 107, 0.25);
}
.btn.danger:active { background: rgba(255, 107, 107, 0.20); }

/* inline-форма ценового алерта */
.alert-form {
  margin-top: 12px;
  padding: 12px;
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.alert-form .segment { margin-bottom: 10px; }
.alert-input-row { display: flex; align-items: center; gap: 8px; }
.alert-input-row input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  outline: none;
  font-variant-numeric: tabular-nums;
}
.alert-input-row input:focus { border-color: rgba(53, 224, 161, 0.4); }
.alert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--accent-dim);
  border: 1px solid rgba(53, 224, 161, 0.28);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
}

/* профиль трейдера: адрес, копирование, ссылка */
.addr-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.mini-btn {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--elevated);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.mini-btn:active { background: var(--overlay); }
.addr-actions .link-btn { min-height: 44px; display: inline-flex; align-items: center; }

/* чипы «мин. сумма алерта» в подписке */
.mn-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mn-label { font-size: 11px; color: var(--hint-strong); flex-shrink: 0; }
.holder-row { cursor: pointer; padding: 6px 0; border-bottom: 1px solid var(--hairline, rgba(255,255,255,0.06)); }
.holder-row:last-child { border-bottom: 0; }

.mn-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.mn-chip {
  min-height: 32px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--elevated);
  color: var(--hint);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.mn-chip.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(53, 224, 161, 0.35);
}

/* toggle-switch (CSS-only) */
.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  display: inline-block;
}
.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.switch .slider {
  position: absolute;
  inset: 0;
  background: var(--elevated);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  transition: background 0.15s, border-color 0.15s;
  pointer-events: none;
}
.switch .slider::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: var(--hint-strong);
  transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .slider {
  background: var(--accent-dim);
  border-color: rgba(53, 224, 161, 0.4);
}
.switch input:checked + .slider::after {
  transform: translateX(19px);
  background: var(--accent);
}
.switch input:focus-visible + .slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* компактные селекты тихих часов */
.qh-selects { display: flex; align-items: center; gap: 6px; }
.qh-selects select {
  min-height: 44px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--elevated);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

.about-links { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.about-links .link-btn { min-height: 44px; display: inline-flex; align-items: center; }

/* paywall: цена */
.price-line {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--accent-dim);
  border: 1px solid rgba(53, 224, 161, 0.28);
  border-radius: var(--radius-sm);
}
.price-line b {
  font-size: 22px;
  color: var(--accent);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.price-line span { font-size: 12.5px; color: var(--hint-strong); }

/* экран закрытой позиции: крупный realized PnL */
.closed-pnl {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 8px 0 4px;
  font-variant-numeric: tabular-nums;
}

/* сработавший алерт — приглушённая карточка */
.muted-card { opacity: 0.65; }

/* онбординг: overlay на весь экран */
#onb-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.onb-card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 28px 20px 20px;
  text-align: center;
  max-width: 340px;
  width: 100%;
  box-shadow: var(--shadow);
}
.onb-glyph { font-size: 44px; line-height: 1.1; margin-bottom: 12px; }
.onb-card h2 { font-size: 20px; font-weight: 750; letter-spacing: -0.02em; margin-bottom: 8px; }
.onb-card p { color: var(--hint); font-size: 14px; line-height: 1.5; }
.onb-dots { display: flex; gap: 6px; justify-content: center; margin: 18px 0 6px; }
.onb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--overlay);
  border: 1px solid var(--line-strong);
}
.onb-dot.active { background: var(--accent); border-color: var(--accent); }

/* админка: крупные цифры метрик, строки пользователей */
.metric-grid.admin b { font-size: 24px; }
.au-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.au-row:last-child { border-bottom: 0; }
.au-main { flex: 1; min-width: 120px; }
.au-main b { display: block; font-size: 14px; }
.au-main .mono { font-size: 11px; }
.au-status {
  font-size: 11px;
  font-weight: 650;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: var(--elevated);
  color: var(--hint);
  flex-shrink: 0;
}
.au-status.ok { background: var(--accent-dim); color: var(--accent); }
.au-status.warn { background: var(--amber-dim); color: var(--amber); }
.au-line { padding: 8px 0; border-bottom: 1px solid var(--line); }
.au-line:last-child { border-bottom: 0; }

/* ================= M16: демо-счёт ================= */
.demo-balance {
  font-size: 32px;
  font-weight: 750;
  letter-spacing: -0.03em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.demo-equity { margin-bottom: 4px; }
.demo-welcome .btn { margin-top: 16px; }
.sparkline-lg { margin-top: 4px; }
.metric-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tabbar .tab span:last-child { font-size: 10px; }
.tabbar { gap: 0; }
.tab { padding: 6px 2px 8px; min-width: 0; flex: 1; }

/* ================= B5: design polish ================= */
.avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.medal {
  position: absolute;
  bottom: -3px;
  right: -5px;
  font-size: 15px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
  pointer-events: none;
  z-index: 1;
}

.empty-card .empty-ico {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  color: var(--hint);
  opacity: 0.72;
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-card .empty-ico svg {
  width: 28px;
  height: 28px;
  display: block;
}

.demo-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  border-radius: var(--radius-pill);
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid rgba(240, 182, 76, 0.35);
}

.meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
  margin-left: auto;
}
.meta-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 650;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--elevated);
  color: var(--hint-strong);
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.meta-chip.up { color: var(--green); background: var(--accent-dim); border-color: rgba(53, 224, 161, 0.22); }
.meta-chip.down { color: var(--red); background: var(--red-dim); border-color: rgba(255, 107, 107, 0.22); }

/* ================= Sprint B: antifarm / templates / method ================= */
.antifarm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 2px 4px;
  flex-wrap: wrap;
}
.antifarm-tip {
  font-size: 11px;
  color: var(--hint);
  line-height: 1.35;
  flex: 1;
  min-width: 140px;
}
.farm-badge,
.noise-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 180, 80, 0.35);
  background: rgba(255, 180, 80, 0.12);
  color: #ffc46b;
  margin: 6px 6px 0 0;
}
.noise-badge {
  border-color: rgba(160, 180, 220, 0.35);
  background: rgba(160, 180, 220, 0.1);
  color: #b8c7e6;
  font-weight: 500;
}
.farm-row { margin-top: 4px; }
.edge-gap {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.35;
}
.alert-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.alert-templates .chip {
  flex: 1 1 auto;
  min-width: 96px;
  text-align: center;
}
.method-snippet {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--hint);
  line-height: 1.4;
}
.method-snippet .link-btn {
  display: inline;
  margin-left: 4px;
  font-size: 11px;
  padding: 0;
  vertical-align: baseline;
}
.c3-toggles.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}
.c3-hint {
  margin: 4px 0 0;
  font-size: 11px !important;
  line-height: 1.35;
}
.hint-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-size: 9px;
  color: var(--hint);
  vertical-align: middle;
  cursor: help;
}
.funnel-trend-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 6px;
}
.funnel-trend-table th,
.funnel-trend-table td {
  padding: 6px 4px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.funnel-trend-table th:first-child,
.funnel-trend-table td:first-child {
  text-align: left;
  color: var(--hint);
  font-weight: 500;
}
.funnel-trend-table th {
  color: var(--hint);
  font-weight: 650;
}

/* ================= Sprint G: risk badges / live / USDT ================= */
.risk-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.risk-chip {
  font-size: 11px;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  color: var(--hint);
  background: rgba(255, 255, 255, 0.03);
}
.risk-chip.caution {
  color: var(--amber);
  border-color: rgba(240, 182, 76, 0.35);
  background: rgba(240, 182, 76, 0.08);
}
.risk-chip.info {
  color: var(--text);
  border-color: rgba(120, 160, 220, 0.28);
  background: rgba(120, 160, 220, 0.08);
}
.risk-disclaimer {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.35;
}
.live-pill {
  font-size: 11px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--green);
  border: 1px solid rgba(53, 224, 161, 0.28);
  background: var(--accent-dim);
}
.live-pill.is-poll {
  color: var(--hint-strong);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
}
.live-price-val {
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.plan-buy-usdt {
  margin-top: 8px;
  width: 100%;
  justify-content: center;
}
.plan-card .plan-buy-usdt.btn.small {
  width: 100%;
  padding: 8px 12px;
}
.top-risk-disc {
  margin: 2px 2px 8px;
  font-size: 11px;
  line-height: 1.35;
}
.demo-pick-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(240, 182, 76, 0.35);
  background: rgba(240, 182, 76, 0.08);
  font-size: 13px;
  font-weight: 650;
  color: var(--amber);
}
.demo-pick-banner .btn {
  margin: 0;
  flex-shrink: 0;
}

/* ================= Sprint I: help + first-run tips ================= */
.help-jump {
  margin-top: 12px;
  width: 100%;
}
.help-card .help-lead {
  margin-top: 8px;
  font-size: 13px;
  color: var(--hint);
  line-height: 1.45;
}
.help-sec {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.help-sec-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hint-strong);
  margin-bottom: 8px;
}
.help-steps,
.help-list {
  margin: 0;
  padding-left: 1.15em;
  color: var(--hint);
  font-size: 13px;
  line-height: 1.5;
}
.help-steps li + li,
.help-list li + li { margin-top: 4px; }
.help-steps b,
.help-list b { color: var(--text); font-weight: 650; }
.help-note {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--hint);
  line-height: 1.45;
}
.help-trust {
  border-top-color: rgba(53, 224, 161, 0.22);
}
.home-tip {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 14px;
  padding: 14px 14px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: linear-gradient(160deg, rgba(53, 224, 161, 0.08), var(--surface) 55%);
}
.home-tip-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.home-tip-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.home-tip-text {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--hint);
  line-height: 1.45;
}
.home-tip-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.home-tip-btn {
  margin: 0;
  min-width: 96px;
}

/* ================= Sprint J: feeds / data source ================= */
.feed-hint {
  margin: 0 2px 10px;
  font-size: 11px;
  line-height: 1.4;
}
.feed-footer {
  display: flex;
  justify-content: center;
  padding: 12px 0 24px;
  min-height: 28px;
}
.feed-footer .btn {
  min-width: 140px;
}
#market-data-footnote {
  margin: 8px 0 0;
}

/* ================= Sprint L: demo guide ================= */
.guide-hero {
  background: linear-gradient(165deg, rgba(53, 224, 161, 0.1), var(--surface) 58%);
  border-color: var(--line-strong);
}
.guide-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.guide-hero h3 {
  margin: 0;
  letter-spacing: -0.01em;
}
.guide-hero .btn {
  margin-top: 14px;
  width: 100%;
}
.guide-card {
  margin-top: 12px;
}
.demo-guide-link {
  display: inline-flex;
  margin: 10px 0 4px;
  font-size: 13px;
  font-weight: 650;
}
.link-btn.inline-link {
  display: inline;
  padding: 0;
  font-size: inherit;
  font-weight: 650;
  vertical-align: baseline;
}
