/* Veins VPN — мини-приложение (Telegram Web App) */

:root {
  --bg: #121214;
  --bg-elevated: #1c1c1f;
  --surface: #2c2c2e;
  --border: #3a3a3c;
  --text: #f5f5f7;
  --muted: #8e8e93;
  --blood: #7c3aed;
  --blood-soft: #a78bfa;
  --accent-glow: rgba(124, 58, 237, 0.35);
  --radius-lg: 20px;
  --radius-md: 14px;
  --nav-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  font-size: 15px;
}

body.mini-app {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

a {
  color: var(--blood-soft);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.mini-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom, 0px));
}

.mini-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  text-align: center;
  padding: 12px 16px 10px;
  padding-top: max(12px, env(safe-area-inset-top, 12px));
  background: linear-gradient(180deg, var(--bg) 60%, transparent);
}

.mini-topbar__brand {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--muted);
}
.mini-topbar__brand strong {
  color: var(--blood-soft);
  font-weight: 700;
}

.mini-topbar--split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}
.mini-topbar__profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.mini-topbar__avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
  flex-shrink: 0;
}
.mini-topbar__profile-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}
.mini-topbar__uname {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-topbar__balance {
  font-size: 0.7rem;
  color: var(--muted);
}
.mini-topbar--split .mini-topbar__brand {
  flex-shrink: 0;
  font-size: 0.8rem;
}

.stars-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.stars-grid .btn-pill {
  width: 100%;
  justify-content: center;
}

.mini-main {
  flex: 1;
}

.mini-scroll {
  padding: 0 16px 24px;
}

/* Промо-баннер */
.promo-banner {
  display: block;
  background: linear-gradient(105deg, #1e3a5f 0%, #1a2f4a 40%, #2a1a24 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
  text-decoration: none;
  color: #e8f4ff;
  font-size: 0.8125rem;
  line-height: 1.4;
  transition: opacity 0.15s;
}
.promo-banner:hover {
  opacity: 0.92;
  text-decoration: none;
}
.promo-banner__text {
  display: block;
}

/* Строка «пользователя» */
.user-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.user-strip__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-strip__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--blood) 0%, #7f1d1d 100%);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--accent-glow);
}

.user-strip__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-strip__name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
}

.user-strip__hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.user-strip__action {
  flex-shrink: 0;
  font-size: 0.8125rem;
  color: var(--blood-soft);
  font-weight: 500;
}
.user-strip__action:hover {
  text-decoration: none;
  color: #fda4af;
}

/* Главная карточка VPN */
.feature-hero-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.feature-hero-card__visual {
  position: relative;
  height: 140px;
  background: linear-gradient(160deg, #2a1218 0%, #1a1520 50%, #12121a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-hero-card__glow {
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.feature-hero-card__shield {
  position: relative;
  width: 88px;
  height: 88px;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.45));
}
.feature-hero-card__shield svg {
  width: 100%;
  height: 100%;
}

.feature-hero-card__body {
  padding: 16px 18px 18px;
}

.feature-hero-card__title {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.feature-hero-card__desc {
  margin: 0 0 14px;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

.feature-hero-card__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(225, 29, 72, 0.2);
  color: var(--blood-soft);
  font-weight: 600;
  font-size: 0.875rem;
  border: 1px solid rgba(225, 29, 72, 0.35);
}
.feature-hero-card__cta:hover {
  background: rgba(225, 29, 72, 0.3);
  text-decoration: none;
}

.mini-note {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* Главная: блок про Telegram ID */
.home-id-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.home-id-card__icon {
  flex-shrink: 0;
  color: var(--blood-soft);
  opacity: 0.9;
}
.home-id-card__text {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
}
.home-id-card__text strong {
  color: var(--text);
  font-weight: 600;
}

/* Страница подписки: Telegram ID */
.tg-id-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.12) 0%, var(--bg-elevated) 100%);
  border: 1px solid rgba(225, 29, 72, 0.25);
  border-radius: var(--radius-md);
}
.tg-id-strip--muted {
  background: var(--bg-elevated);
  border-color: var(--border);
}
.tg-id-strip__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.tg-id-strip__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--blood-soft);
  background: rgba(0, 0, 0, 0.25);
  padding: 4px 10px;
  border-radius: 8px;
}
.tg-id-strip__hint {
  flex-basis: 100%;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
}

/* Внутренние страницы */
.page-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-lead {
  margin: 0 0 18px;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}
.page-lead strong {
  color: var(--text);
  font-weight: 600;
}
.page-lead--id {
  margin-top: -8px;
  font-size: 0.8125rem;
}
.page-lead--id code {
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  color: var(--blood-soft);
  background: rgba(225, 29, 72, 0.15);
  padding: 2px 8px;
  border-radius: 6px;
}

.panel-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.panel-card__h {
  margin: 0 0 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.panel-card__muted {
  margin: 0 0 10px;
  font-size: 0.75rem;
  color: var(--muted);
}

.panel-card__p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.ref-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.ref-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
}
.ref-stat__value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--blood-soft);
  font-variant-numeric: tabular-nums;
}
.ref-stat__label {
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.error-text {
  color: #f87171;
  margin-top: 8px;
}

.help-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.875rem;
  color: var(--text);
}
.help-list li {
  margin-bottom: 8px;
}

.field-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  margin-bottom: 10px;
  font-family: inherit;
}
.field-input.mono {
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
}

.field-hint {
  margin: 10px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 18px;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  font-size: 0.9375rem;
  font-family: inherit;
  cursor: pointer;
}
.btn-pill.primary {
  background: linear-gradient(180deg, var(--blood) 0%, #9f1239 100%);
  color: #fff;
}
.btn-pill.primary:active {
  opacity: 0.9;
}

.url-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
@media (min-width: 380px) {
  .url-row {
    flex-direction: row;
    align-items: stretch;
  }
  .url-row .field-input {
    flex: 1;
    margin-bottom: 0;
  }
  .url-row .btn-pill {
    width: auto;
    min-width: 110px;
  }
}

.alert-card {
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.alert-card.bad {
  border-color: rgba(225, 29, 72, 0.45);
  color: #fecaca;
}
.alert-card p {
  margin: 8px 0 12px;
  font-size: 0.875rem;
  color: var(--muted);
}

.link-inline {
  font-size: 0.875rem;
}

.inline-code,
.mono {
  font-family: ui-monospace, monospace;
  font-size: 0.8em;
}

.sub-header {
  margin-bottom: 8px;
}

/* Нижняя навигация */
.mini-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding-top: 8px;
  background: rgba(18, 18, 20, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.mini-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 4px;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 500;
  text-decoration: none;
}
.mini-nav__item:hover {
  text-decoration: none;
  color: var(--text);
}

.mini-nav__item.is-active {
  color: var(--blood-soft);
}

.mini-nav__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}
.mini-nav__item.is-active .mini-nav__icon {
  opacity: 1;
}

.mini-footer-legal {
  text-align: center;
  padding: 8px 16px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
}

.admin-link {
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.5;
}

body.tg-webapp .mini-topbar {
  padding-top: max(8px, env(safe-area-inset-top, 8px));
}

/* --- Экран подписки /go/… (как в референсе Need VPN) --- */
:root {
  --tg-blue: #2aabee;
  --tg-blue-hover: #4db8f0;
}

.mini-scroll--sub {
  padding-bottom: 8px;
}

.sub-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.sub-user-row__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sub-user-row__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sub-user-row__avatar[src] {
  display: block;
  object-fit: cover;
  padding: 0;
}

.sub-user-row__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sub-user-row__name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.sub-user-row__hint {
  font-size: 0.72rem;
  color: var(--muted);
}

.sub-connect-pill {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--tg-blue);
  color: #fff !important;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none !important;
}
.sub-connect-pill:hover {
  background: var(--tg-blue-hover);
  text-decoration: none !important;
}

.sub-brand-block {
  text-align: center;
  margin-bottom: 18px;
}

.sub-brand-block--sm .sub-brand-block__shield {
  width: 72px;
  height: 72px;
  margin: 0 auto 10px;
}

.sub-brand-block__shield svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.35));
}

.sub-brand-block__title {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.sub-brand-block__tagline {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
  padding: 0 4px;
}

.plan-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 16px 18px;
  margin-bottom: 12px;
}

.plan-card--bad {
  border-color: rgba(225, 29, 72, 0.35);
}

.plan-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.plan-card__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.plan-card__refresh {
  background: none;
  border: none;
  color: var(--tg-blue);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 0;
}

.plan-card__plan-name {
  margin: 0 0 12px;
  font-size: 0.875rem;
  color: var(--muted);
}

.plan-card__field-label {
  margin: 0 0 6px;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sub-url-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 4px 4px 12px;
  margin-bottom: 14px;
}

.sub-url-box__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.75rem;
  font-family: ui-monospace, monospace;
  padding: 8px 0;
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-url-box__copy {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sub-url-box__copy:hover {
  color: var(--text);
}

.plan-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.plan-status-item {
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
}

.plan-status-item--wide {
  grid-column: 1 / -1;
}

.plan-status-item__k {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.plan-status-item__v {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.plan-status-item__status {
  font-size: 0.8125rem;
  font-weight: 600;
}

.plan-status-item__status--ok {
  color: #4ade80;
}

.plan-card__error {
  margin: 0 0 14px;
  font-size: 0.875rem;
  color: #fca5a5;
  line-height: 1.45;
}

.btn-tg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none !important;
  margin-bottom: 10px;
  border: none;
  font-family: inherit;
  cursor: pointer;
  box-sizing: border-box;
}

.btn-tg--primary {
  background: var(--tg-blue);
  color: #fff !important;
}
.btn-tg--primary:hover {
  background: var(--tg-blue-hover);
}

.btn-tg--secondary {
  background: var(--surface);
  color: var(--text) !important;
  border: 1px solid var(--border);
}
.btn-tg--secondary:hover {
  background: #3a3a3c;
}

.plan-card__more {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.plan-card__more-label {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.plan-card__links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.8125rem;
}

.link-copy {
  background: none;
  border: none;
  color: var(--tg-blue);
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.plan-card__dot {
  color: var(--muted);
}

.sub-page-handle {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 16px 0 0;
  opacity: 0.7;
}

/* Совместимость со старыми классами */
.site-header,
.site-footer {
  display: none;
}
