/* =========================================================
   Nova — design tokens
   Тема: шахта аметиста. Тёмная порода, деревянные крепи,
   тёплый свет фонаря, дрейфующая в воздухе каменная пыль
   с блёстками самоцветов (см. particles.js).
   Карточки — гранёные, как выступающая из породы жила.
========================================================= */

:root {
  --bg-void: #120d1a;
  --bg-rock: #211730;
  --bg-rock-2: #2b1d3d;
  --border-soft: rgba(155, 107, 255, 0.22);
  --border-timber: rgba(138, 90, 52, 0.45);

  --timber: #8a5a34;
  --timber-light: #a97a4c;
  --timber-dark: #4a2e1a;

  --gem-amethyst: #9b6bff;
  --gem-amethyst-deep: #6a3fd9;
  --gem-emerald: #2fd897;
  --gem-lantern: #f4c15c;
  --gem-garnet: #ff5d6c;

  /* Категории тарифов — ротация доходности между ними (см. tariff_rotation) */
  --gem-diamond: #38bdf8;
  --gem-diamond-deep: #0c6b96;
  --gem-ruby: #ff4d6d;
  --gem-ruby-deep: #99182f;

  --text-pale: #ede7fb;
  --text-muted: #a297c4;
  --text-faint: #6c6094;

  --font-display: "Big Shoulders Display", sans-serif;
  --font-body: "Manrope", sans-serif;
  --font-mono: "Space Mono", monospace;

  --radius-soft: 16px;
  --shadow-ambient: 0 20px 60px rgba(5, 3, 12, 0.6);
  --tabbar-height: 68px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-void);
  color: var(--text-pale);
  font-family: var(--font-body);
  min-height: 100vh;
  touch-action: manipulation;
}

body {
  background:
    radial-gradient(ellipse 60% 40% at 20% -5%, rgba(244, 193, 92, 0.10), transparent 55%),
    radial-gradient(circle at 85% 15%, rgba(155, 107, 255, 0.14), transparent 45%),
    radial-gradient(circle at 10% 85%, rgba(47, 216, 151, 0.05), transparent 40%),
    /* тонкое зерно породы */
    repeating-radial-gradient(circle at 0 0, rgba(255,255,255,0.015) 0 1px, transparent 1px 3px),
    var(--bg-void);
  background-size: auto, auto, auto, 6px 6px, auto;
}

#gem-particles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

button { font-family: inherit; }
.hidden { display: none !important; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 18px calc(var(--tabbar-height) + 24px);
  position: relative;
  z-index: 1;
}

/* ============ Состояния верхнего уровня ============ */

.state--loading,
.state--locked {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 0 12px;
}

.state--loading p { color: var(--text-muted); }

.facet-spinner {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gem-amethyst), var(--gem-lantern));
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
  animation: spin 1.1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.locked-gem {
  font-size: 40px;
  color: var(--gem-amethyst);
}

.state--locked h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin: 0;
}

.state--locked p {
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 340px;
}

.locked-pitch {
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 360px;
  margin: 0;
}

.locked-features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  margin: 4px 0;
}

.locked-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bg-rock);
  border: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--text-pale);
  text-align: left;
}

.locked-feature span {
  color: var(--gem-amethyst);
  font-size: 16px;
  flex-shrink: 0;
}

.locked-hint {
  color: var(--text-faint);
  font-size: 12.5px;
  max-width: 300px;
  margin: 0;
}

/* ============ Standalone-лендинги (устаревшая ссылка и т.п.) ============ */

.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  padding: 40px 20px;
  position: relative;
  z-index: 1;
}

.landing__gem {
  font-size: 52px;
  color: var(--gem-amethyst);
  text-shadow: 0 0 24px rgba(155, 107, 255, 0.5);
}

.landing__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin: 0;
}

.landing__text {
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 380px;
  margin: 0;
}

.landing__actions {
  margin-top: 8px;
}

.landing__hint {
  color: var(--text-faint);
  font-size: 13px;
  max-width: 340px;
  margin-top: 4px;
}

.landing__hint code {
  background: var(--bg-rock);
  border: 1px solid var(--border-soft);
  padding: 1px 6px;
  border-radius: 6px;
  font-family: var(--font-mono);
  color: var(--gem-lantern);
}

/* ============ Шапка: вход в шахту ============ */

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  margin-bottom: 22px;
}

/* Несущая балка над шапкой — деревянная перекладина входа в шахту */
.topbar::before {
  content: "";
  position: absolute;
  top: 0;
  left: -18px;
  right: -18px;
  height: 8px;
  background:
    repeating-linear-gradient(90deg, var(--timber-light) 0 2px, var(--timber) 2px 18px, var(--timber-dark) 18px 20px),
    linear-gradient(var(--timber), var(--timber));
  box-shadow: 0 3px 10px rgba(0,0,0,0.4);
}

.topbar::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 10px;
  right: 10px;
  height: 4px;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,0.35) 0 3px, transparent 3px 34px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand__mark {
  color: var(--gem-amethyst);
  font-size: 20px;
  text-shadow: 0 0 12px rgba(155, 107, 255, 0.6);
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.welcome-banner {
  margin: -10px 0 20px;
  font-size: 14px;
  color: var(--text-muted);
}

.welcome-banner #welcome-name {
  color: var(--gem-lantern);
  font-weight: 700;
}

.header-balance {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--bg-rock);
  border: 1px solid var(--border-soft);
  color: var(--text-pale);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.header-balance:hover {
  border-color: var(--gem-amethyst);
}

.header-balance:active {
  transform: scale(0.96);
}

.header-balance:focus-visible {
  outline: 2px solid var(--gem-amethyst);
  outline-offset: 2px;
}

.header-balance__star {
  color: var(--gem-lantern);
  margin-right: 2px;
}

/* ============ Деревянный разделитель секций ============ */

.beam-divider {
  height: 10px;
  margin: 26px 0;
  border-radius: 3px;
  background:
    repeating-linear-gradient(90deg, var(--timber-light) 0 2px, var(--timber) 2px 18px, var(--timber-dark) 18px 20px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 2px 6px rgba(0,0,0,0.35);
  position: relative;
}

.beam-divider::before,
.beam-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--timber-dark);
  transform: translateY(-50%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.3);
}

.beam-divider::before { left: 16px; }
.beam-divider::after { right: 16px; }

/* ============ Карточка баланса ============ */

.balance-card {
  background: linear-gradient(160deg, var(--bg-rock-2), var(--bg-rock));
  border: 1px solid var(--border-soft);
  border-top: 3px solid var(--timber);
  border-radius: var(--radius-soft);
  padding: 22px 20px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-ambient);
}

.balance-card__label {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.balance-card__value {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.balance-card__unit {
  color: var(--gem-amethyst);
  font-size: 22px;
}

.balance-card__sub {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.balance-card__topup {
  margin-top: 14px;
}

/* ============ Секции ============ */

.tab-panel { animation: fade-in 0.25s ease both; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.section { margin-bottom: 12px; }

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section__head h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--text-pale);
}

.empty-state {
  border: 1px dashed var(--border-soft);
  border-radius: var(--radius-soft);
  padding: 18px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state p { margin: 4px 0; }
.empty-state__hint { font-size: 13px; color: var(--text-faint); }

/* ============ Гранёные карточки (жилы) ============ */

.investments-list,
.tariffs-list,
.premium-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gem-card {
  position: relative;
  background:
    radial-gradient(circle at 85% 15%, rgba(155,107,255,0.10), transparent 55%),
    linear-gradient(155deg, var(--bg-rock-2), var(--bg-rock));
  border: 1px solid var(--border-soft);
  clip-path: polygon(
    18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px
  );
  padding: 18px 20px;
  overflow: hidden;
  animation: rise 0.4s ease both;
}

.investments-list .gem-card:nth-child(2) { animation-delay: 0.05s; }
.investments-list .gem-card:nth-child(3) { animation-delay: 0.1s; }
.investments-list .gem-card:nth-child(4) { animation-delay: 0.15s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.gem-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gem-card__amount {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
}

.gem-card__percent {
  color: var(--gem-emerald);
  font-size: 13px;
  font-weight: 600;
}

.gem-card__meta {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  margin-top: 2px;
}

/* ============ Обёртка вклада: алмаз отдельно, инфо-карточка отдельно ============ */

.investment-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.investment-info {
  width: 100%;
  margin-top: 10px;
  padding: 14px 20px;
}

/* ============ Алмаз-кликер ============ */

.diamond-clicker {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 4px auto 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.diamond-glow {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 72%;
  height: 72%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(155, 107, 255, 0.55), transparent 70%);
  filter: blur(14px);
  animation: diamond-breathe 3.2s ease-in-out infinite;
  z-index: 0;
}

.investment-item[data-category="diamond"] .diamond-glow {
  background: radial-gradient(circle, rgba(56, 189, 248, 0.55), transparent 70%);
}

.investment-item[data-category="ruby"] .diamond-glow {
  background: radial-gradient(circle, rgba(255, 77, 109, 0.55), transparent 70%);
}

.diamond-clicker.is-ready .diamond-glow {
  background: radial-gradient(circle, rgba(47, 216, 151, 0.6), transparent 70%);
  animation-duration: 1.5s;
}

@keyframes diamond-breathe {
  0%, 100% { opacity: 0.45; transform: scale(0.9); }
  50% { opacity: 0.95; transform: scale(1.08); }
}

.mega-diamond {
  position: relative;
  z-index: 2;
  width: 106px;
  height: 106px;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: block;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  animation: diamond-idle 4s ease-in-out infinite;
}

/* Раньше клик отключал кнопку через нативный disabled — в некоторых WebView
   (в т.ч. телеграмовском) это подменяет вид кнопки дефолтным disabled-стилем
   поверх кастомного SVG, из-за чего алмаз на миг "пропадал". Вместо disabled —
   свой класс, который просто блокирует клики, не трогая внешний вид. */
.mega-diamond.is-busy {
  pointer-events: none;
}

@keyframes diamond-idle {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.02); }
}

.mega-diamond.is-clicking {
  animation: diamond-click-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes diamond-click-pop {
  0% { transform: scale(1) rotate(0); }
  35% { transform: scale(0.85) rotate(-4deg); }
  65% { transform: scale(1.14) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}

.mega-diamond svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 8px 16px rgba(5, 3, 12, 0.55));
  /* Аметист — цвет по умолчанию (в т.ч. для category="amethyst") */
  --f1: #d9c8ff;
  --f2: #a179ff;
  --f3: #9b6bff;
  --f4: #b794ff;
  --f5: #8a5cf5;
  --f6: #4a2a92;
  --f7: #6238b8;
}

/* Категория вклада красит алмаз, пока он активен. Правила ниже должны идти
   ПЕРЕД .is-ready (одинаковая специфичность — при готовности вклада алмаз
   всегда становится изумрудным независимо от категории, единый сигнал "забери"). */
.investment-item[data-category="diamond"] .mega-diamond svg {
  --f1: #cdeffe;
  --f2: #7dd3f9;
  --f3: #38bdf8;
  --f4: #5ec8fa;
  --f5: #29a3e0;
  --f6: #0c5a80;
  --f7: #156d99;
}

.investment-item[data-category="ruby"] .mega-diamond svg {
  --f1: #ffd1d9;
  --f2: #ff8fa3;
  --f3: #ff4d6d;
  --f4: #ff6b85;
  --f5: #e0334f;
  --f6: #7a1128;
  --f7: #99182f;
}

.diamond-clicker.is-ready .mega-diamond svg {
  --f1: #baf5e0;
  --f2: #4fdfaf;
  --f3: #2fd897;
  --f4: #7be8c4;
  --f5: #26c288;
  --f6: #147454;
  --f7: #1a9268;
}

.mega-diamond svg path {
  stroke: rgba(15, 8, 28, 0.4);
  stroke-width: 1;
  stroke-linejoin: round;
  transition: fill 0.4s ease;
}

.mega-diamond svg path.f1 { fill: var(--f1); }
.mega-diamond svg path.f2 { fill: var(--f2); }
.mega-diamond svg path.f3 { fill: var(--f3); }
.mega-diamond svg path.f4 { fill: var(--f4); }
.mega-diamond svg path.f5 { fill: var(--f5); }
.mega-diamond svg path.f6 { fill: var(--f6); }
.mega-diamond svg path.f7 { fill: var(--f7); }

.mega-diamond:focus-visible {
  outline: 2px solid var(--gem-lantern);
  outline-offset: 6px;
  border-radius: 8px;
}

.diamond-timer {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  text-align: center;
  line-height: 1.15;
  pointer-events: none;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7), 0 0 14px rgba(0, 0, 0, 0.4);
}

.diamond-caption {
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

.diamond-clicker.is-ready + .diamond-caption {
  color: var(--gem-emerald);
}

/* Осколки, разлетающиеся при клике */
.diamond-shards {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 4;
}

.shard {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  background: var(--shard-color, var(--gem-amethyst));
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  opacity: 0.95;
  animation: shard-fly 0.7s ease-out forwards;
}

@keyframes shard-fly {
  to {
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) rotate(var(--rot-end, 180deg));
    opacity: 0;
  }
}

/* Всплывающий текст обратной связи (-30с / +150 ◆) */
.diamond-float-text {
  position: absolute;
  left: 50%;
  top: 6%;
  transform: translate(-50%, 0);
  z-index: 5;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--gem-lantern);
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  white-space: nowrap;
  animation: float-up-fade 0.9s ease-out forwards;
}

.diamond-float-text--success { color: var(--gem-emerald); }

@keyframes float-up-fade {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -36px) scale(1); }
}

/* Вспышка кайла по грани при клике-ускорении */
.gem-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(244,193,92,0.35) 50%, transparent 60%);
  transform: translateX(-120%);
  pointer-events: none;
}

.gem-card.is-flashing::after {
  animation: facet-flash 0.5s ease;
}

@keyframes facet-flash {
  to { transform: translateX(120%); }
}

/* ============ Кнопки ============ */

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn:focus-visible {
  outline: 2px solid var(--gem-amethyst);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--gem-amethyst);
  color: #150c24;
}

.btn--ghost {
  background: transparent;
  color: var(--text-pale);
  border: 1px solid var(--border-soft);
}

.btn--success {
  background: var(--gem-emerald);
  color: #0c2318;
}

.btn--block { width: 100%; }
.btn--sm { padding: 8px 14px; font-size: 13px; }

/* ============ Тарифы ============ */

.tariff-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.tariff-card__info {
  min-width: 0; /* даёт длинным строкам ужиматься, а не расталкивать кнопку */
}

.tariff-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.tariff-card__name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: var(--text-pale);
}

.tariff-card__percent {
  font-family: var(--font-mono);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--gem-emerald);
  margin-bottom: 4px;
}

.tariff-card__stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.tariff-card__stat-dot {
  font-family: var(--font-body);
  color: var(--text-faint);
}

.tariff-card--locked { opacity: 0.55; }

.tariff-card__badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  text-transform: none;
  white-space: nowrap;
  background: rgba(244, 193, 92, 0.16);
  color: var(--gem-lantern);
}

.tariff-card__btn {
  flex-shrink: 0;
  min-width: 92px;
}

.tariff-card__percent-base {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-faint);
  text-decoration: line-through;
  margin-right: 6px;
}

.tariff-card--boosted {
  border-color: rgba(244, 193, 92, 0.5);
  box-shadow: 0 0 0 1px rgba(244, 193, 92, 0.15), var(--shadow-ambient);
}

/* ============ Вкладки категорий (Алмазы / Аметисты / Рубины) ============ */

.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.category-tab {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: var(--bg-rock);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.category-tab:active { transform: scale(0.96); }

.category-tab--diamond.is-active { color: var(--gem-diamond); border-color: rgba(56, 189, 248, 0.5); }
.category-tab--amethyst.is-active { color: var(--gem-amethyst); border-color: rgba(155, 107, 255, 0.5); }
.category-tab--ruby.is-active { color: var(--gem-ruby); border-color: rgba(255, 77, 109, 0.5); }

.category-tab__fire {
  font-size: 11px;
}

/* Золотое свечение + мерцающие искры у категории с бонусом сегодня */
.category-tab--boosted {
  color: var(--gem-lantern) !important;
  border-color: rgba(244, 193, 92, 0.55) !important;
  animation: tab-glow-pulse 2.2s ease-in-out infinite;
}

@keyframes tab-glow-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(244, 193, 92, 0.25); }
  50% { box-shadow: 0 0 16px rgba(244, 193, 92, 0.55), 0 0 28px rgba(244, 193, 92, 0.2); }
}

.category-tab__spark {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gem-lantern);
  box-shadow: 0 0 6px 1px rgba(244, 193, 92, 0.9);
  opacity: 0;
  pointer-events: none;
  animation: spark-twinkle 1.8s ease-in-out infinite;
}

.category-tab__spark--1 { top: 2px; left: 14%; animation-delay: 0s; }
.category-tab__spark--2 { top: 55%; right: 8%; animation-delay: 0.6s; }
.category-tab__spark--3 { bottom: 3px; left: 52%; animation-delay: 1.2s; }

@keyframes spark-twinkle {
  0%, 100% { opacity: 0; transform: scale(0.4); }
  50% { opacity: 1; transform: scale(1.15); }
}

.category-panels {
  position: relative;
}

.category-section__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ============ Плашки тарифов — цвет по драгоценному камню категории ============ */

.tariff-card--diamond {
  border-color: rgba(56, 189, 248, 0.32);
  background:
    radial-gradient(circle at 85% 15%, rgba(56, 189, 248, 0.14), transparent 55%),
    linear-gradient(155deg, var(--bg-rock-2), var(--bg-rock));
}

.tariff-card--amethyst {
  border-color: rgba(155, 107, 255, 0.32);
  background:
    radial-gradient(circle at 85% 15%, rgba(155, 107, 255, 0.14), transparent 55%),
    linear-gradient(155deg, var(--bg-rock-2), var(--bg-rock));
}

.tariff-card--ruby {
  border-color: rgba(255, 77, 109, 0.32);
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 77, 109, 0.14), transparent 55%),
    linear-gradient(155deg, var(--bg-rock-2), var(--bg-rock));
}

/* Буст поверх цвета категории — золотая рамка/свечение побеждает (идёт позже в файле) */
.tariff-card--boosted {
  border-color: rgba(244, 193, 92, 0.55);
  box-shadow: 0 0 0 1px rgba(244, 193, 92, 0.18), var(--shadow-ambient);
}

.tariff-card__percent--boosted {
  color: var(--gem-lantern) !important;
}

/* ============ Бейдж категории (в карточке вклада) ============ */

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  border: 1px solid transparent;
}

.category-badge--diamond {
  color: var(--gem-diamond);
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.3);
}

.category-badge--amethyst {
  color: var(--gem-amethyst);
  background: rgba(155, 107, 255, 0.14);
  border-color: rgba(155, 107, 255, 0.3);
}

.category-badge--ruby {
  color: var(--gem-ruby);
  background: rgba(255, 77, 109, 0.14);
  border-color: rgba(255, 77, 109, 0.3);
}

/* ============ Кошелёк: переключатель Вывод / Premium ============ */

.wallet-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.wallet-tab {
  flex: 1;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: var(--bg-rock);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.wallet-tab:active { transform: scale(0.96); }

.wallet-tab.is-active {
  color: var(--gem-lantern);
  border-color: rgba(244, 193, 92, 0.5);
}

.wallet-panel.hidden { display: none; }

/* ============ Карточка вывода средств ============ */

.withdraw-card {
  margin-bottom: 14px;
}

.withdraw-card__balance {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.withdraw-card__label {
  font-size: 13px;
  color: var(--text-muted);
}

.withdraw-card__value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--gem-emerald);
}

.withdraw-card__hint {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--text-faint);
  line-height: 1.5;
}

.withdraw-card .field:last-of-type {
  margin-bottom: 14px;
}

.withdraw-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.withdraw-history__item {
  background: var(--bg-rock);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 12px 14px;
}

.withdraw-history__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.withdraw-history__amount {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
}

.withdraw-history__status {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.withdraw-history__item--pending .withdraw-history__status {
  color: var(--gem-lantern);
  background: rgba(244, 193, 92, 0.16);
}

.withdraw-history__item--approved .withdraw-history__status {
  color: var(--gem-emerald);
  background: rgba(47, 216, 151, 0.16);
}

.withdraw-history__item--rejected .withdraw-history__status {
  color: var(--gem-garnet);
  background: rgba(255, 93, 108, 0.16);
}

.withdraw-history__requisites {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.withdraw-history__comment {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-faint);
  font-style: italic;
}

/* ============ Premium ============ */

.premium-card {
  border: 1px solid rgba(244, 193, 92, 0.28);
  background:
    radial-gradient(circle at 85% 15%, rgba(244,193,92,0.10), transparent 55%),
    linear-gradient(155deg, var(--bg-rock-2), var(--bg-rock));
}

.premium-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.premium-card h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  text-transform: uppercase;
}

.premium-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12.5px;
}

.premium-card__price {
  font-family: var(--font-mono);
  color: var(--gem-lantern);
  font-size: 13px;
}

/* ============ Нижняя навигация ============ */

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(480px, 100%);
  display: flex;
  height: var(--tabbar-height);
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: rgba(18, 13, 26, 0.92);
  backdrop-filter: blur(10px);
  border-top: 3px solid var(--timber);
  z-index: 40;
}

.tabbar__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0 4px;
}

.tabbar__icon {
  font-size: 19px;
  line-height: 1;
}

.tabbar__btn.is-active {
  color: var(--gem-amethyst);
  text-shadow: 0 0 10px rgba(155, 107, 255, 0.5);
}

.tabbar__btn:focus-visible {
  outline: 2px solid var(--gem-amethyst);
  outline-offset: -2px;
}

/* ============ Тосты ============ */

.toast-stack {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-height) + 16px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  width: min(420px, calc(100% - 32px));
}

.toast {
  background: var(--bg-rock-2);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13.5px;
  box-shadow: var(--shadow-ambient);
  animation: toast-in 0.25s ease both;
}

.toast--error { border-color: rgba(255, 93, 108, 0.5); }
.toast--success { border-color: rgba(47, 216, 151, 0.5); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ Модалка ============ */

.modal {
  border: none;
  border-radius: var(--radius-soft);
  padding: 0;
  background: transparent;
  max-width: 360px;
  width: calc(100% - 40px);
}

.modal::backdrop {
  background: rgba(5, 3, 12, 0.7);
  backdrop-filter: blur(2px);
}

.modal__card {
  background: var(--bg-rock-2);
  border: 1px solid var(--border-soft);
  border-top: 3px solid var(--timber);
  border-radius: var(--radius-soft);
  padding: 22px;
  margin: 0;
}

.modal__card h3 {
  font-family: var(--font-display);
  color: white;
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.modal__hint {
  color: var(--text-muted);
  font-size: 12.5px;
  margin: 0 0 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.field input {
  background: var(--bg-void);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-pale);
  font-family: var(--font-mono);
  font-size: 16px;
}

/* Убираем стрелки-степпер у числовых полей (сумма пополнения/вклада) —
   визуально мешают и лишние на мобильном, где ввод всё равно с клавиатуры. */
.field input[type="number"] {
  -moz-appearance: textfield;
}

.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field input:focus-visible {
  outline: 2px solid var(--gem-amethyst);
  outline-offset: 1px;
}

.modal__estimate {
  font-size: 13px;
  color: var(--gem-emerald);
  min-height: 18px;
  margin: 0 0 14px;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============ Пополнение: реквизиты и ожидание ============ */

.topup-requisites {
  background: var(--bg-void);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.topup-requisites__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border-soft);
}

.topup-requisites__row:last-child { border-bottom: none; }

.topup-requisites__row span { color: var(--text-muted); }
.topup-requisites__row strong {
  font-family: var(--font-mono);
  font-weight: 700;
  text-align: right;
}

.topup-waiting {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 14px;
}

.facet-spinner--sm {
  width: 16px;
  height: 16px;
}

/* ============ Плашка "платёж ожидает" (свёрнутый попап пополнения) ============ */

.pending-payment-badge {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-height) + 14px);
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(244, 193, 92, 0.4);
  background: rgba(43, 29, 61, 0.95);
  backdrop-filter: blur(8px);
  color: var(--gem-lantern);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-ambient);
  cursor: pointer;
  max-width: calc(100% - 32px);
  white-space: nowrap;
}

.pending-payment-badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gem-lantern);
  animation: pending-dot-pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pending-dot-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* ============ Реферальная программа ============ */

.referral-card__pitch {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.referral-card__pitch strong {
  color: var(--gem-emerald);
}

.referral-card__link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.referral-card__link {
  flex: 1;
  min-width: 0;
  background: var(--bg-void);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-pale);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.referral-card__stats {
  display: flex;
  gap: 12px;
}

.referral-card__stat {
  flex: 1;
  text-align: center;
  background: var(--bg-void);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 10px 8px;
}

.referral-card__stat-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--gem-emerald);
}

.referral-card__stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
