*{
  margin:0;padding:0;box-sizing:border-box;
  font-family:-apple-system,BlinkMacSystemFont,"Inter",sans-serif;
}

:root{
  --app-top-offset: 45px; /* дополнительный отступ сверху для всего приложения */
}

html,body{
  height:100%;
}

body{
  background:#000;
  color:#fff;
  overflow:hidden;
  /* system safe-area top + наш общий offset + высота шапки */
  padding-top:calc(var(--tg-safe-area-inset-top, 0px) + var(--app-top-offset) + 35px);
  touch-action:manipulation; /* уменьшает шансы зума жестами */
}

/* ==================== ANIMATED LIGHT BACKGROUND ==================== */
.bg-light{
  position:fixed;
  top:0; left:0;
  width:100%; height:350px;
  overflow:hidden;
  z-index:-1;
}

.light-layer{
  position:absolute;
  width:145%;
  height:145%;
  top:-40%;
  left:-40%;
  background:radial-gradient(circle at 30% 30%, rgba(255,230,120,0.6), rgba(255,150,50,0.15), transparent 70%);
  filter:blur(40px);
  animation:moveLight 14s ease-in-out infinite;
  pointer-events:none;
  transition:background 0.6s ease-in-out, filter 0.6s ease-in-out, opacity 0.6s ease-in-out;
}

@keyframes moveLight{
  0%   { transform:translate(0px,0px)  rotate(0deg); }
  50%  { transform:translate(120px,-80px) rotate(15deg); }
  100% { transform:translate(0px,0px)  rotate(0deg); }
}

/* TON color version */
.light-blue{
  background:radial-gradient(circle at 30% 30%, rgba(90,150,255,0.55), rgba(60,90,255,0.18), transparent 70%);
}

/* ==================== HEADER ==================== */
.header{
  position:fixed;
  /* system safe-area top + наш глобальный offset */
  top:calc(var(--tg-safe-area-inset-top, 0px) + var(--app-top-offset));
  left:0;
  width:100%;
  padding:0 20px;
  z-index:50;
}

.header-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.header-title{
  font-size:18px;
  opacity:0.9;
  font-weight:600;
}

/* history icon / bell */
.header-btn{
  width:38px;height:38px;
  background:rgba(255,255,255,0.12);
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:18px;
  backdrop-filter:blur(6px);
  transition:0.25s;
  cursor:pointer;
}
.header-btn:active{ transform:scale(.92); }

/* иконка в хедере */
.header-btn img{
  width:20px;
  height:20px;
  display:block;
}

/* ==================== WALLET INFO ==================== */
.wallet-box{
  margin-top:20px;
  padding:0 20px;
}

.wallet-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:6px;
}
.wallet-label{
  font-size:13px;
  opacity:0.85;
  letter-spacing:1px;
}

.currency-switch{
  display:flex;
  align-items:center;
  gap:4px;
  background:rgba(34,34,34,0.2);
  padding:4px 10px;
  border-radius:12px;
  font-size:13px;
  cursor:pointer;
  backdrop-filter:blur(6px);
}

/* BALANCE */
.balance{
  font-size:44px;
  font-weight:700;
  letter-spacing:-1px;
}

.balance-small{
  font-size:19px;
  opacity:0.7;
}

.growth{
  margin-top:6px;
  font-size:14px;
  opacity:0.9;
  color:#ffd35c;
}

/* ==================== ACTION BUTTONS ==================== */
.btn-row{
  margin-top:25px;
  padding:0 20px;
  display:flex;
  justify-content:center;  /* центрируем группу */
  align-items:center;
  gap:10px;
}

.btn{
  flex:0 0 auto;           /* НЕ растягиваем, ширина по контенту/классу */
  text-align:center;
  padding:12px 10px;
  background:rgba(255,255,255,0.08);
  border-radius:18px;
  cursor:pointer;
  transition:transform 0.18s ease-out, opacity 0.18s ease-out, box-shadow 0.18s ease-out;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;              /* иконка + текст по горизонтали */
  font-size:14px;
}
.btn:active{ transform:scale(.94); }

/* фиксированная ширина для "Пополнить" и "Вывод" */
.btn-main{
  min-width:120px;
  padding:12px 18px;
}

/* иконка */
.btn-icon{
  font-size:20px;
}

/* иконки в кнопках */
.btn-icon img{
  width:20px;
  height:20px;
  display:block;
}

/* компактная кнопка перевода — только иконка */
.btn-transfer{
  width:52px;
  height:44px;
  padding:0;
  border-radius:18px;
  display:flex;
  align-items:center;
  justify-content:center;
}

/* ==================== SCROLL / TAB CONTENT ==================== */
.scroll-area{
  position:fixed;
  left:0;
  /* ниже шапки + блока с балансом, с учётом safe-area + нашего offset */
  top:calc(var(--tg-safe-area-inset-top, 0px) + var(--app-top-offset) + 260px);
  width:100%;
  /* высота = весь экран - верхняя часть - нижнее меню - нижний safe-area */
  height:calc(
    100vh
    - (var(--tg-safe-area-inset-top, 0px) + var(--app-top-offset) + 260px)
    - 48px
    - var(--tg-safe-area-inset-bottom, 0px)
  );
  overflow:hidden; /* скролл внутри табов */
}

/* плавные табы */
.tab-content{
  position:absolute;
  top:0;
  left:0;
  width:100%;
  height:100%;
  box-sizing:border-box;
  padding:0 20px 24px;
  overflow-y:auto;
  opacity:0;
  transform:translateX(24px);
  pointer-events:none;
  transition:opacity .28s ease, transform .28s ease;
  /* FIX: неактивные табы вообще не участвуют в разметке и не перекрывают экран */
  display:none;
  z-index:0;
}
.tab-content--active{
  opacity:1;
  transform:translateX(0);
  pointer-events:auto;
  /* FIX: только активный таб показываем */
  display:block;
  z-index:1;
}

/* заголовок + иконка инфо */
.section-title-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:18px;
}

.section-title{
  font-size:20px;
  font-weight:600;
}

/* кнопка-инфо без фона */
.info-btn{
  border:none;
  background:none;
  padding:0;
  margin:0;
  width:22px;
  height:22px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.info-btn img{
  width:18px;
  height:18px;
  display:block;
}

.plan{
  background:#111;
  border-radius:18px;
  padding:18px;
  border:1px solid rgba(255,255,255,0.06);
  margin-bottom:18px;
  transition:transform 0.18s ease-out, box-shadow 0.18s ease-out, opacity 0.18s ease-out;
  box-shadow:0 8px 26px rgba(0,0,0,0.25);
}
.plan:active{ transform:scale(.97); }

.plan-head{
  display:flex;
  justify-content:space-between;
  margin-bottom:8px;
}
.plan-percent{ opacity:.85; }

.plan-btn{
  margin-top:14px;
  padding:12px 0;
  border-radius:14px;
  background:#222;
  text-align:center;
  cursor:pointer;
  font-size:16px;
  transition:transform 0.18s ease-out, opacity 0.18s ease-out, box-shadow 0.18s ease-out;
}
.plan-btn:active{ transform:scale(.95); }

.placeholder-text{
  font-size:14px;
  opacity:0.75;
  margin-top:8px;
  line-height:1.5;
}

/* ==================== BOTTOM NAV (УМЕНЬШЕНО ~ В 2 РАЗА) ==================== */
.bottom-nav{
  position:fixed;
  left:50%;
  transform:translateX(-50%);
  bottom:calc(var(--tg-safe-area-inset-bottom, 0px) + 20px); /* отступ 20px от низа */
  width:calc(60% - 40px); /* боковой отступ по 20px */
  max-width:460px;
  height:48px; /* было 90px */
  background:rgba(5,5,10,0.96);
  border-radius:15px;
  border:1px solid #181820;
  display:flex; 
  justify-content:space-around;
  align-items:center;
  z-index:100;
  backdrop-filter:blur(16px);
}

.nav-item{
  text-align:center;
  font-size:11px;
  opacity:.6;
  cursor:pointer;
  transition:transform 0.16s.ease-out, opacity 0.16s ease-out, color 0.16s ease-out;
  color:rgba(255,255,255,0.6);
}
.nav-item:active{ transform:scale(.9); }

/* активная вкладка — белая, неактивная приглушённая */
.nav-item--active{
  color:#ffffff;
  opacity:1;
}

.nav-icon{
  font-size:18px;
  display:block;
  margin-bottom:2px;
}

/* картинки в нижнем меню */
.nav-icon img{
  width:18px;  /* было 24px */
  height:18px;
  display:block;
  margin:0 auto;
}

/* ==================== MODAL ==================== */
/* Базовое состояние — модалки нет */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;   /* <<< ВАЖНО */
  transition: opacity 0.2s ease-out;
  z-index: 50;
}

/* Когда модалка открыта */
.modal-bg--visible {
  opacity: 1;
  pointer-events: auto;   /* <<< Теперь ловит клики */
}

.modal{
  background:#111;
  padding:22px;
  border-radius:18px;
  width:86%;
  transform:translateY(24px) scale(0.98);
  opacity:0;
  transition:transform .25s ease, opacity .25s.ease;
}
.modal-bg.modal-bg--visible .modal{
  transform:translateY(0) scale(1);
  opacity:1;
}

.modal input{
  width:100%;
  margin-top:12px;
  padding:12px;
  border-radius:12px;
  border:none;
  background:#222;
  color:#fff;
  font-size:16px;
}

/* базовый стиль кнопок в модалках (минимальный) */
.modal button{
  border:none;
  border-radius:14px;
  color:#fff;
  font-size:17px;
  cursor:pointer;
}

/* отдельный стиль для кнопки "Вложить" в модалке суммы */
.modal-invest-btn{
  margin-top:16px;
  width:100%;
  padding:13px;
  background:linear-gradient(135deg,#222,#222);
  color:#111;
  font-weight:600;
  letter-spacing:0.02em;
  transition:transform 0.16s ease-out, box-shadow 0.16s ease-out, opacity 0.16s ease-out;
}
.modal-invest-btn:active{
  transform:scale(0.96) translateY(1px);
  opacity:0.95;
}

/* отдельный стиль для кнопки "Понятно" в инфо-модалке */
.modal-info-btn{
  margin-top:18px;
  width:100%;
  padding:12px;
  background:#222;
  color:#fff;
  font-size:16px;
  font-weight:500;
  border-radius:14px;
  box-shadow:0 6px 16px rgba(0,0,0,0.45);
  transition:transform 0.16s ease-out, box-shadow 0.16s ease-out, opacity 0.16s ease-out;
}
.modal-info-btn:active{
  transform:scale(0.96) translateY(1px);
  box-shadow:0 3px 8px rgba(0,0,0,0.4);
  opacity:0.95;
}

/* депозитное окно с обводкой в нашем стиле */
.modal--deposit{
  border:1px solid rgba(255,255,255,0.12);
  box-shadow:0 12px 28px rgba(0,0,0,0.6);
}

/* ====== КЛАССЫ ДЛЯ ЖИВОЙ АНИМАЦИИ НАЖАТИЯ (мобайл + десктоп) ====== */
.pressable{
  /* transition уже прописан у большинства, но дублирование не мешает */
  transition:transform 0.16s ease-out, opacity 0.16s ease-out, box-shadow 0.16s ease-out;
}
.pressable.is-pressed{
  transform:scale(0.94) translateY(1px);
  opacity:0.85;
  box-shadow:0 6px 14px rgba(0,0,0,0.55);
}

/* ==================== CUSTOM TOAST ==================== */
.toast-container{
  position:fixed;
  left:50%;
  bottom:calc(var(--tg-safe-area-inset-bottom, 0px) + 80px);
  transform:translateX(-50%);
  z-index:300;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  pointer-events:none;
}

.toast{
  min-width:180px;
  max-width:360px;
  background:rgba(17,17,17,0.92);
  backdrop-filter:blur(14px);
  padding:12px 18px;
  border-radius:16px;
  color:#fff;
  font-size:14px;
  text-align:center;
  opacity:0;
  transform:translateY(15px);
  transition:opacity .35s ease, transform .35s ease;
  border:1px solid rgba(31,31,31,1);
  pointer-events:auto;
}

.toast.show{
  opacity:1;
  transform:translateY(0px);
}

.toast.hide{
  opacity:0;
  transform:translateY(15px);
}

/* ==================== DEPOSIT MODAL CUSTOM ==================== */
.deposit-tabs{
  display:flex;
  gap:8px;
  margin:12px 0 10px;
  background:#181818;
  padding:4px;
  border-radius:12px;
}

.deposit-tab{
  flex:1;
  padding:8px 0;
  border-radius:9px;
  border:none;
  background:transparent;
  color:rgba(255,255,255,0.6);
  font-size:14px;
  cursor:pointer;
  transition:background .2s ease, color .2s ease, transform .16s ease;
}

.deposit-tab--active{
  background:#262626;
  color:#fff;
}

.deposit-field{
  margin-top:10px;
}

.deposit-label{
  font-size:13px;
  opacity:0.8;
  margin-bottom:4px;
}

.deposit-value-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:#1b1b1b;
  border-radius:12px;
  padding:10px 12px;
  gap:10px;
  cursor:pointer;
}

.deposit-value{
  font-size:14px;
  word-break:break-all;
}

/* Кнопка копирования: справа, 20x20, без растянутого фона */
.deposit-copy-btn{
  width:20px;
  height:20px;
  border-radius:4px;
  border:none;
  background:transparent;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  flex-shrink:0;
}
.deposit-copy-btn img{
  width:20px;
  height:20px;
  display:block;
}

.deposit-note{
  margin-top:14px;
  font-size:13px;
  line-height:1.5;
  opacity:0.9;
}

.deposit-close-btn{
  margin-top:16px;
  width:100%;
  padding:12px;
  border:none;
  border-radius:14px;
  background:#222;
  color:#fff;
  font-size:16px;
  cursor:pointer;
}

/* ====== HISTORY MODAL ====== */
#historyList{
  margin-top:8px;
  /* высота примерно на 5 операций */
  max-height: calc(5 * 48px); /* 5 рядов по ~48px */
  overflow-y: auto;
  padding-right:4px; /* чтобы скролл не лип к тексту */
}

/* опционально — более аккуратный скролл под WebKit */
#historyList::-webkit-scrollbar{
  width:4px;
}
#historyList::-webkit-scrollbar-track{
  background:transparent;
}
#historyList::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,0.25);
  border-radius:4px;
}

/* ==================== REFERRALS (INVITE + LEVELS) ==================== */
.ref-main-tabs{
  display:flex;
  background:#111;
  border-radius:14px;
  padding:4px;
  margin-bottom:14px;
  border:1px solid rgba(255,255,255,0.06);
}

.ref-tab{
  flex:1;
  padding:8px 0;
  border-radius:10px;
  border:none;
  background:transparent;
  font-size:14px;
  color:rgba(255,255,255,0.6);
  cursor:pointer;
  transition:background .2s ease, color .2s.ease, transform .16s ease;
}
.ref-tab--active{
  background:radial-gradient(circle at 20% 0%, #ffe67633, #ffffff0f);
  color:#fff;
}

.ref-panels{
  position:relative;
}

.ref-panel{
  opacity:0;
  pointer-events:none;
  transform:translateX(16px);
  transition:opacity .2s ease, transform .2s ease;
  position:absolute;
  top:0;
  left:0;
  width:100%;
}
.ref-panel--active{
  opacity:1;
  pointer-events:auto;
  transform:translateX(0);
}

/* общие блоки внутри рефералок */
.ref-block{
  background:#111;
  border-radius:16px;
  padding:14px 14px 12px;
  border:1px solid rgba(255,255,255,0.06);
  box-shadow:0 8px 20px rgba(0,0,0,0.35);
  margin-bottom:12px;
}

.ref-label{
  font-size:13px;
  opacity:0.8;
  margin-bottom:6px;
}

.ref-link-row{
  display:flex;
  align-items:center;
  gap:8px;
}

.ref-link-input{
  flex:1;
  min-width:0;
  border:none;
  border-radius:11px;
  padding:9px 10px;
  background:#181818;
  color:#fff;
  font-size:13px;
  outline:none;
  overflow:hidden;
  text-overflow:ellipsis;
}

.ref-invite-copy-btn{
  flex:0 0 auto;
  padding:9px 12px;
  border-radius:11px;
  border:none;
  background:#222;
  color:#fff;
  font-size:13px;
  cursor:pointer;
  white-space:nowrap;
  box-shadow:0 6px 14px rgba(0,0,0,0.4);
  transition:transform .16s ease-out, box-shadow .16s ease-out, opacity .16s ease-out;
}
.ref-invite-copy-btn:active{
  transform:scale(0.95) translateY(1px);
  box-shadow:0 3px 8px rgba(0,0,0,0.35);
  opacity:0.9;
}

.ref-description{
  font-size:13px;
  line-height:1.5;
  opacity:0.9;
}

.ref-stats{
  font-size:13px;
  opacity:0.85;
}

/* Друзья / уровни */
.ref-friends-header{
  font-size:14px;
  font-weight:500;
  margin-bottom:10px;
  opacity:0.95;
}

.ref-level-tabs{
  display:flex;
  gap:6px;
  margin-bottom:10px;
}

.ref-level-tab{
  flex:1;
  padding:7px 0;
  border-radius:9px;
  border:none;
  background:#101010;
  color:rgba(255,255,255,0.6);
  font-size:13px;
  cursor:pointer;
  transition:background .18s ease, color .18s ease, transform .16s.ease;
}
.ref-level-tab--active{
  background:#1f1f1f;
  color:#fff;
}

.ref-level-panels{
  position:relative;
}

.ref-level-panel{
  position:absolute;
  top:0;
  left:0;
  width:100%;
  opacity:0;
  pointer-events:none;
  transform:translateX(12px);
  transition:opacity .2s.ease, transform .2s.ease;
}
.ref-level-panel--active{
  opacity:1;
  pointer-events:auto;
  transform:translateX(0);
}

.ref-level-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:8px;
}

.ref-stat-card{
  background:#111;
  border-radius:14px;
  padding:10px 8px;
  text-align:center;
  border:1px solid rgba(255,255,255,0.06);
  box-shadow:0 6px 16px rgba(0,0,0,0.35);
}

.ref-stat-label{
  font-size:11px;
  opacity:0.7;
  margin-bottom:4px;
}

.ref-stat-value{
  font-size:13px;
  font-weight:600;
}
/* ==================== WITHDRAW MODAL ==================== */

.modal--withdraw{
  border:1px solid rgba(255,255,255,0.12);
  box-shadow:0 12px 28px rgba(0,0,0,0.6);
  padding-top:18px;
  padding-bottom:18px;
}

/* Внутренний контейнер с полями */
.withdraw-body{
  margin-top:8px;
  display:flex;
  flex-direction:column;
}

/* Подписи к полям (как deposit-label) */
.withdraw-label{
  font-size:13px;
  opacity:0.8;
  margin-top:10px;
  margin-bottom:4px;
}

/* Инпуты (как в депозитах, но чутка крупнее) */
.withdraw-input{
  width:100%;
  border:none;
  border-radius:12px;
  padding:11px 12px;
  background:#181818;
  color:#fff;
  font-size:15px;
  outline:none;
}
.withdraw-input::placeholder{
  color:rgba(255,255,255,0.35);
}

/* Блок "Вы получите" */
.withdraw-net{
  margin-top:12px;
  padding:10px 12px;
  border-radius:12px;
  background:linear-gradient(135deg,#171717,#111);
  border:1px solid rgba(255,255,255,0.06);
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:8px;
}

.withdraw-net__label{
  font-size:13px;
  opacity:0.8;
}

.withdraw-net__value{
  font-size:15px;
  font-weight:600;
}

/* Текст про комиссию / MEMO (как deposit-note) */
.withdraw-fee-note{
  margin-top:10px;
  font-size:12.5px;
  line-height:1.5;
  opacity:0.9;
}

/* Кнопка "Подтвердить вывод" внизу модалки */
.withdraw-modal-btn{
  margin-top:16px;
  width:100%;
  padding:13px 12px;
  border:none;
  border-radius:14px;
  background:#222;
  color:#fff;
  font-size:16px;
  font-weight:500;
  box-shadow:0 8px 20px rgba(0,0,0,0.55);
  cursor:pointer;
  transition:transform 0.16s ease-out,
             box-shadow 0.16s ease-out,
             opacity 0.16s ease-out;
}
.withdraw-modal-btn:active{
  transform:scale(0.96) translateY(1px);
  box-shadow:0 4px 10px rgba(0,0,0,0.45);
  opacity:0.95;
}

/* Крестик закрытия (доп. мелкая настройка, можно не трогать) */
.withdraw-close-btn{
  width:24px;
  height:24px;
}
.withdraw-close-btn img{
  width:18px;
  height:18px;
  display:block;
}
/* Вкладки выбора валюты в модалке вывода (как в пополнении) */
.withdraw-tabs{
  display:flex;
  gap:8px;
  margin:8px 0 10px;
  background:#181818;
  padding:4px;
  border-radius:12px;
}

.withdraw-tab{
  flex:1;
  padding:8px 0;
  border-radius:9px;
  border:none;
  background:transparent;
  color:rgba(255,255,255,0.6);
  font-size:14px;
  cursor:pointer;
  transition:background .2s ease,
             color .2s ease,
             transform .16s ease;
}

.withdraw-tab--active{
  background:#262626;
  color:#fff;
}
