/* UletVPN Mini App — неоновый фиолетовый с переливом в салатовый */

:root {
  --bg-dark: #0a0710;
  --bg-card: rgba(26, 18, 40, 0.85);
  --bg-card-hover: rgba(40, 28, 60, 0.95);
  --text: #f5f3f8;
  --text-muted: #b8b0cc;
  --accent-purple: #b24ae8;
  --accent-salad: #3dffb8;
  --accent-lime: #7fff7f;
  --neon-purple: #d946ef;
  --neon-salad: #00ff9d;
  --neon-glow-purple: rgba(217, 70, 239, 0.7);
  --neon-glow-salad: rgba(0, 255, 157, 0.6);
  --gradient-main: linear-gradient(135deg, #d946ef 0%, #a855f7 35%, #8b5cf6 60%, #3dffb8 100%);
  --gradient-btn: linear-gradient(135deg, #d946ef 0%, #a855f7 50%, #3dffb8 100%);
  --border-radius: 14px;
  --btn-gap: 12px;
  --page-pad: clamp(0.75rem, 3.5vw, 1.25rem);
  --screen-pad: clamp(0.5rem, 2vh, 1.25rem);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: 
    radial-gradient(ellipse 140% 80% at 10% 0%, rgba(217, 70, 239, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse 100% 70% at 90% 100%, rgba(61, 255, 184, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse 80% 50% at 50% 50%, rgba(139, 92, 246, 0.08) 0%, transparent 70%),
    #0a0710;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: 
    radial-gradient(circle at 20% 30%, rgba(217, 70, 239, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(61, 255, 184, 0.12) 0%, transparent 40%);
  animation: bgPulse 8s ease-in-out infinite;
}

@keyframes bgPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.app {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: var(--page-pad);
  padding-top: calc(env(safe-area-inset-top, 0px) + var(--page-pad));
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--page-pad));
  display: flex;
  flex-direction: column;
}

/* Лоадер */
body.app-loading #app {
  opacity: 0;
  pointer-events: none;
}

body.app-loading #globalLoader {
  display: flex;
}

#globalLoader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 7, 16, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(217, 70, 239, 0.2);
  border-top-color: var(--neon-salad);
  border-right-color: var(--neon-purple);
  animation: spin 0.8s linear infinite;
  box-shadow: 0 0 20px var(--neon-glow-purple), 0 0 40px var(--neon-glow-salad);
}

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

.btn-back {
  background: transparent;
  border: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 6px 0;
}

.btn-back:active { opacity: 0.8; }

/* Карточки — стекло + неоновая обводка */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(217, 70, 239, 0.3);
  border-radius: var(--border-radius);
  padding: 16px;
  margin-bottom: var(--btn-gap);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(217, 70, 239, 0.5), transparent 40%, rgba(61, 255, 184, 0.3));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.card:active {
  background: var(--bg-card-hover);
  box-shadow: 0 0 20px rgba(217, 70, 239, 0.2);
}

/* Кнопки — единый отступ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-decoration: none;
  color: #0a0710;
  margin-bottom: var(--btn-gap);
}

.btn:last-child { margin-bottom: 0; }

.btn:active {
  transform: scale(0.98);
}

@media (hover: none) {
  .btn {
    -webkit-tap-highlight-color: transparent;
  }
  .btn-install.btn-secondary {
    border-color: var(--accent-salad);
    box-shadow: 0 0 20px var(--neon-glow-salad);
  }
  .btn-secondary:not(.btn-install):active {
    border-color: rgba(217, 70, 239, 0.5);
    box-shadow: 0 0 15px rgba(217, 70, 239, 0.1);
  }
  .btn-primary:active {
    box-shadow: 0 0 20px var(--neon-glow-purple), 0 4px 20px rgba(217, 70, 239, 0.4);
  }
  .btn-news:active {
    box-shadow: 0 0 20px var(--neon-glow-salad), 0 4px 20px rgba(61, 255, 184, 0.4);
  }
}

@media (hover: hover) {
  .btn-secondary:hover {
    border-color: var(--accent-salad);
    box-shadow: 0 0 20px var(--neon-glow-salad);
  }
  .btn-primary:hover {
    box-shadow: 0 0 30px var(--neon-glow-purple), 0 0 50px var(--neon-glow-salad);
  }
  .btn-news:hover {
    box-shadow: 0 0 30px var(--neon-glow-salad), 0 0 50px rgba(61, 255, 184, 0.6);
  }
}

.btn-primary {
  background: var(--gradient-btn);
  color: #0a0710;
  box-shadow: 
    0 0 20px var(--neon-glow-purple),
    0 4px 20px rgba(217, 70, 239, 0.4),
    inset 0 1px 0 rgba(255,255,255,0.25);
  position: relative;
}


.btn-secondary {
  background: rgba(40, 28, 60, 0.6);
  color: var(--text);
  border: 1px solid rgba(217, 70, 239, 0.5);
  box-shadow: 0 0 15px rgba(217, 70, 239, 0.1);
}

.btn-news {
  background: linear-gradient(135deg, #2dd4a0 0%, #3dffb8 50%, #00ff9d 100%);
  color: #0a0710;
  border: none;
  box-shadow:
    0 0 20px var(--neon-glow-salad),
    0 4px 20px rgba(61, 255, 184, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Главная — блоки с единым отступом */
.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 12px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* Статус-блок — неоновый акцент */
.status-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(217, 70, 239, 0.35);
  border-radius: var(--border-radius);
  margin-bottom: var(--btn-gap);
  box-shadow: 0 0 30px rgba(217, 70, 239, 0.08);
}

.status-block > div:first-child,
.status-block > div:last-child {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 44px;
}

.status-name { font-weight: 600; font-size: 1.1rem; }

.status-value {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.status-value.active {
  color: var(--accent-salad);
  text-shadow: 0 0 12px var(--neon-glow-salad);
  font-weight: 600;
}

.status-value.expired { color: #f87171; }

/* Сетка кнопок — равные отступы */
.buttons-grid {
  display: flex;
  flex-direction: column;
  gap: var(--btn-gap);
  margin-top: var(--btn-gap);
}

.buttons-grid .btn { margin-bottom: 0; }

.buttons-grid .btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--btn-gap);
}

.buttons-grid .btn-row .btn { margin-bottom: 0; }

.buttons-grid .btn.full-width { grid-column: 1 / -1; }

/* Блоки на главной — единый gap */
.btn-block { margin-bottom: var(--btn-gap); }

#screen-home .status-block,
#screen-home #resetDevicesWrap,
#screen-home #trialBlock,
#screen-home #buyRow,
#screen-home #homeSubLinkWrap,
#screen-home .buttons-grid {
  margin-bottom: var(--btn-gap);
}

#screen-home #resetDevicesWrap .btn,
#screen-home #trialBlock .btn,
#screen-home #buyRow .btn {
  margin-bottom: 0;
}

/* Покупка подписки */
.device-selector { margin-bottom: var(--btn-gap); }

.device-selector .card { margin-bottom: var(--btn-gap); }

.device-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.device-dot {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(217, 70, 239, 0.5);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.device-dot:hover {
  border-color: var(--accent-salad);
  box-shadow: 0 0 15px var(--neon-glow-salad);
}

.device-dot.active {
  background: var(--gradient-main);
  border-color: transparent;
  color: #0a0710;
  box-shadow: 0 0 20px var(--neon-glow-salad), 0 0 30px var(--neon-glow-purple);
}

.device-benefit {
  margin-top: 10px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--accent-salad);
  text-shadow: 0 0 12px var(--neon-glow-salad);
  min-height: 1.1em;
}

.tariffs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--btn-gap);
  margin-bottom: var(--btn-gap);
}

.tariff-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(217, 70, 239, 0.3);
  border-radius: var(--border-radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tariff-card:hover {
  border-color: var(--accent-salad);
  box-shadow: 0 0 25px var(--neon-glow-salad);
  transform: translateY(-2px);
}

.tariff-card.selected {
  border-color: var(--accent-salad);
  box-shadow: 0 0 25px var(--neon-glow-salad), 0 0 40px var(--neon-glow-purple);
  background: linear-gradient(135deg, rgba(217, 70, 239, 0.2) 0%, rgba(61, 255, 184, 0.15) 100%);
}

.tariff-badge {
  position: static;
  margin-top: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--accent-salad);
  text-shadow: 0 0 15px var(--neon-glow-salad);
}

.tariff-label { font-weight: 600; margin-bottom: 4px; }

.tariff-price {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, #d946ef, #3dffb8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tariff-per-month { font-size: 0.75rem; color: var(--text-muted); }

.pay-button-wrap {
  margin-top: var(--btn-gap);
}

.pay-button-wrap .btn {
  font-size: 1.05rem;
  margin-bottom: 0;
}

.pay-button-wrap .strike {
  text-decoration: line-through;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-left: 6px;
}

/* Профиль */
.profile-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.profile-id {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.copy-btn {
  background: rgba(61, 255, 184, 0.12);
  border: 1px solid rgba(61, 255, 184, 0.35);
  border-radius: 10px;
  color: var(--accent-salad);
  cursor: pointer;
  padding: 8px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.copy-btn .copy-icon,
.copy-btn .check-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.copy-btn .check-icon {
  display: none;
  animation: checkPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.copy-btn.copied .copy-icon {
  display: none;
}

.copy-btn.copied .check-icon {
  display: block;
  color: var(--accent-salad);
}

.copy-btn:hover {
  color: var(--neon-salad);
  background: rgba(61, 255, 184, 0.2);
  box-shadow: 0 0 12px var(--neon-glow-salad);
}

.copy-btn.copied {
  background: rgba(61, 255, 184, 0.25);
  border-color: var(--accent-salad);
  box-shadow: 0 0 15px var(--neon-glow-salad);
}

@keyframes checkPop {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.menu-list .card {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  margin-bottom: var(--btn-gap);
  padding: 14px 16px;
}

.menu-list .card:last-child { margin-bottom: 0; }

.sub-link-block { margin-top: var(--btn-gap); }

.sub-link-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.sub-link-value {
  word-break: break-all;
  font-size: 0.8rem;
  color: var(--accent-salad);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Модальные окна */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 7, 16, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
}

.modal {
  background: var(--bg-dark);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(217, 70, 239, 0.4);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(217, 70, 239, 0.25);
}

.modal-title { font-size: 1.1rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.agreement-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  white-space: pre-line;
  line-height: 1.6;
}

/* Рефералка */
.referral-desc {
  margin-bottom: var(--btn-gap);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.referral-link-wrap { margin: var(--btn-gap) 0; }

.referral-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.referral-link-input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(217, 70, 239, 0.5);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.85rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.referral-link-input:focus {
  outline: none;
  border-color: var(--accent-salad);
  box-shadow: 0 0 15px var(--neon-glow-salad);
}

.referral-copy {
  flex-shrink: 0;
}

.history-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.txn-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(217, 70, 239, 0.2);
  font-size: 0.9rem;
}

.txn-item:last-child { border-bottom: none; }

.txn-amount {
  color: var(--accent-salad);
  font-weight: 600;
}

.txn-status.completed { color: var(--accent-salad); }
.txn-status.pending { color: var(--text-muted); }

.payment-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--btn-gap);
}

.install-icon-wrap { text-align: center; margin: 24px 0; }

.install-buttons .btn { margin-bottom: var(--btn-gap); }
.install-buttons .btn:last-child { margin-bottom: 0; }

/* Экраны */
.screen {
  display: none;
  width: 100%;
}

.screen.active {
  display: block;
  flex: 1;
  padding-top: var(--screen-pad);
  padding-bottom: var(--screen-pad);
}

#screen-home.active,
#screen-purchase.active,
#screen-profile.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
}

.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.error-msg {
  color: #f87171;
  font-size: 0.9rem;
  margin-top: 8px;
}

.link-external {
  color: var(--accent-salad);
  text-decoration: none;
}

.link-external:hover { text-decoration: underline; }

.pay-method-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--btn-gap);
}

/* Landing: открытие по ссылке без Telegram */
.landing-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--page-pad);
  background: inherit;
}

.landing-content {
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.landing-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 16px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-desc {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

.landing-widget {
  margin-bottom: 20px;
  min-height: 50px;
  display: flex;
  justify-content: center;
}

.landing-widget iframe {
  border-radius: var(--border-radius);
}

.landing-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.landing-btn {
  text-decoration: none;
  display: inline-flex;
}

