:root{
  --bg:#101116;
  --bg-deep:#0b0c11;
  --surface:#171922;
  --surface-2:#1d202b;
  --surface-3:#232737;
  --text:#f4f6ff;
  --muted:#98a1bb;
  --muted-2:#717b99;
  --line:rgba(255,255,255,.105);
  --line-soft:rgba(255,255,255,.075);
  --line-accent:rgba(139,77,255,.56);
  --blue:#4e7cff;
  --violet:#8b4dff;
  --violet-2:#a855f7;
  --good:#75f0bd;
  --warn:#ffd166;
  --bad:#ff6b8a;
  --shadow:0 22px 60px rgba(0,0,0,.36);
  --shadow-soft:0 14px 34px rgba(0,0,0,.25);
  --radius-xl:30px;
  --radius-lg:24px;
  --radius-md:18px;
}

*{box-sizing:border-box}

html{
  background:var(--bg);
  color:var(--text);
}

body{
  margin:0;
  min-height:100vh;
  font-family:-apple-system,BlinkMacSystemFont,"Inter","Segoe UI",Roboto,Arial,sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 18% -8%,rgba(78,124,255,.16),transparent 30%),
    radial-gradient(circle at 92% 8%,rgba(139,77,255,.15),transparent 34%),
    linear-gradient(180deg,#11131a 0%,#101116 48%,#0d0e13 100%);
  -webkit-font-smoothing:antialiased;
  text-rendering:geometricPrecision;
}

body:before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,255,255,.018) 1px,transparent 1px);
  background-size:64px 64px;
  mask-image:linear-gradient(180deg,rgba(0,0,0,.55),transparent 72%);
  opacity:.45;
}

a{
  color:inherit;
  text-decoration:none;
}

.wrap{
  position:relative;
  z-index:1;
  width:min(1060px,100%);
  margin:0 auto;
  padding:24px 16px 46px;
}

.hero{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin:4px 0 22px;
}

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

.logo-glass{
  width:118px;
  height:118px;
  padding:12px;
  border-radius:28px;
  background:linear-gradient(180deg,rgba(255,255,255,.075),rgba(255,255,255,.035));
  border:1px solid rgba(255,255,255,.11);
  box-shadow:var(--shadow-soft),inset 0 1px 0 rgba(255,255,255,.08);
  display:flex;
  align-items:center;
  justify-content:center;
  margin-right:2px;
}

.logo img{
  width:88px;
  height:88px;
  object-fit:contain;
  filter:drop-shadow(0 12px 26px rgba(139,77,255,.28));
}

.brand h1{
  margin:0;
  font-size:46px;
  line-height:.92;
  letter-spacing:-.055em;
  color:#fff;
}

.brand p{
  margin:8px 0 0;
  color:var(--muted);
  font-size:15px;
  font-weight:650;
}

.badge{
  padding:10px 14px;
  border:1px solid rgba(117,240,189,.24);
  border-radius:999px;
  background:rgba(117,240,189,.07);
  color:#a9ffd9;
  font-weight:850;
  font-size:13px;
  box-shadow:0 0 0 1px rgba(255,255,255,.025) inset;
}

.grid{
  display:grid;
  grid-template-columns:1.05fr .95fr;
  gap:18px;
}

.card{
  background:linear-gradient(180deg,var(--surface-2),var(--surface));
  border:1px solid var(--line);
  border-radius:var(--radius-xl);
  box-shadow:var(--shadow);
  overflow:hidden;
}

.card:hover{
  border-color:rgba(139,77,255,.25);
}

.pad{
  padding:22px;
}

.mainTitle{
  font-size:38px;
  line-height:1.02;
  letter-spacing:-.045em;
  margin:0 0 10px;
}

.mainText{
  color:var(--muted);
  font-size:15px;
  line-height:1.58;
  margin:0 0 20px;
}

.stats{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:11px;
  margin:19px 0;
}

.stat{
  min-height:86px;
  padding:15px;
  border-radius:20px;
  background:rgba(255,255,255,.035);
  border:1px solid var(--line-soft);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.035);
}

.stat b{
  display:block;
  font-size:19px;
  line-height:1.12;
  letter-spacing:-.025em;
  margin-bottom:7px;
}

.stat span{
  display:block;
  color:var(--muted-2);
  font-size:12px;
  font-weight:750;
  line-height:1.25;
}

.status-active b{
  color:var(--good);
}

.status-inactive b{
  color:var(--bad);
}

.btns{
  display:flex;
  flex-wrap:wrap;
  gap:9px;
}

.btn,
a.btn,
button.btn{
  -webkit-appearance:none;
  appearance:none;
  display:flex!important;
  align-items:center;
  justify-content:center;
  width:auto;
  min-height:50px;
  padding:12px 17px!important;
  border-radius:16px!important;
  border:1px solid rgba(255,255,255,.14)!important;
  background:rgba(255,255,255,.04)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.045)!important;
  color:#eef2ff!important;
  text-decoration:none!important;
  font-size:14px!important;
  font-weight:850!important;
  line-height:1.15!important;
  letter-spacing:.005em;
  cursor:pointer!important;
  position:relative;
  transition:
    transform .16s ease,
    box-shadow .16s ease,
    border-color .16s ease,
    background .16s ease,
    color .16s ease;
}

button.btn{
  font:inherit;
}

.btn:hover,
a.btn:hover,
button.btn:hover{
  transform:translateY(-1px);
  border-color:var(--line-accent)!important;
  background:linear-gradient(135deg,rgba(78,124,255,.22),rgba(139,77,255,.28))!important;
  color:#fff!important;
  box-shadow:0 12px 28px rgba(78,124,255,.16),inset 0 1px 0 rgba(255,255,255,.08)!important;
}

.btn:active{
  transform:translateY(0) scale(.99);
}

.btn.primary,
a.btn.primary,
button.btn.primary{
  border-color:rgba(139,77,255,.60)!important;
  background:linear-gradient(135deg,#4e7cff 0%,#665dff 45%,#8b4dff 100%)!important;
  color:#fff!important;
  box-shadow:0 14px 30px rgba(86,96,255,.26),inset 0 1px 0 rgba(255,255,255,.18)!important;
}

.btn.primary:hover,
a.btn.primary:hover,
button.btn.primary:hover{
  background:linear-gradient(135deg,#5d86ff 0%,#7a67ff 42%,#a855f7 100%)!important;
  box-shadow:0 16px 36px rgba(139,77,255,.28),inset 0 1px 0 rgba(255,255,255,.18)!important;
}

.btn.full,
a.btn.full,
button.btn.full{
  width:100%!important;
}

.btn.loading{
  opacity:.75;
  pointer-events:none;
}

.tabs{
  display:flex;
  gap:8px;
  padding:7px;
  background:rgba(255,255,255,.035);
  border:1px solid var(--line-soft);
  border-radius:21px;
  margin-bottom:15px;
}

.tab{
  flex:1;
  border:1px solid transparent;
  border-radius:15px;
  padding:12px 10px;
  color:var(--muted);
  background:transparent;
  font-weight:900;
  cursor:pointer;
  transition:.16s ease;
}

.tab:hover{
  color:#fff;
  border-color:rgba(139,77,255,.35);
}

.tab.active{
  background:linear-gradient(135deg,rgba(78,124,255,.20),rgba(139,77,255,.22));
  border-color:rgba(139,77,255,.34);
  color:#fff;
}

.panel{
  display:none;
}

.panel.active{
  display:block;
}

.connect-card{
  margin-top:14px;
  padding:18px;
  border-radius:24px;
  background:rgba(255,255,255,.032);
  border:1px solid var(--line-soft);
}

.connect-card h3{
  margin:0 0 8px;
  font-size:22px;
  letter-spacing:-.025em;
}

.connect-card p{
  margin:0 0 15px;
  color:var(--muted);
  line-height:1.52;
  font-size:15px;
}

.connect-icon{
  width:42px;
  height:42px;
  border-radius:16px;
  background:linear-gradient(135deg,rgba(78,124,255,.16),rgba(139,77,255,.18));
  border:1px solid rgba(139,77,255,.20);
  display:grid;
  place-items:center;
  margin-bottom:11px;
  font-size:21px;
}

.linkbox{
  margin-top:13px;
  padding:14px;
  border-radius:18px;
  background:#11131b;
  border:1px dashed rgba(139,77,255,.34);
  color:#cbd5f5;
  font-size:12px;
  word-break:break-all;
  line-height:1.5;
}

.hidden{
  display:none!important;
}

.auth-page{
  display:none;
  margin-top:28px;
}

body.auth-mode .grid,
body.auth-mode #connect,
body.auth-mode .payref-grid{
  display:none!important;
}

body.auth-mode .auth-page{
  display:block!important;
}

.auth-page .auth-screen{
  max-width:680px;
  margin:0 auto;
  padding:30px;
  border-radius:30px;
  background:linear-gradient(180deg,var(--surface-2),var(--surface));
  border:1px solid var(--line);
  box-shadow:var(--shadow);
}

.auth-page h2{
  margin:0 0 12px;
  font-size:42px;
  letter-spacing:-.045em;
}

.auth-page p{
  margin:0 0 19px;
  color:var(--muted);
  line-height:1.55;
  font-size:17px;
}

.auth-actions{
  display:grid;
  gap:12px;
}

.email-login-box{
  display:none;
  gap:10px;
  flex-direction:column;
  margin-bottom:12px;
}

.email-login-box input{
  width:100%;
  box-sizing:border-box;
  border-radius:18px;
  border:1px solid var(--line);
  padding:16px;
  background:#101116;
  color:white;
  outline:none;
}

.email-login-box input:focus{
  border-color:var(--line-accent);
  box-shadow:0 0 0 4px rgba(139,77,255,.10);
}

#emailCodeInput,
#emailVerifyBtn{
  display:none;
}

.email-login-msg,
.auth-hint{
  color:var(--muted);
  font-size:14px;
  line-height:1.4;
}

.payref-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
  margin-top:18px;
}

.payref-card{
  position:relative;
  overflow:hidden;
}

.payref-card:before{
  content:"";
  position:absolute;
  inset:-90px -90px auto auto;
  width:190px;
  height:190px;
  border-radius:999px;
  background:radial-gradient(circle,rgba(139,77,255,.20),transparent 66%);
  pointer-events:none;
}

.payref-card h3{
  margin:0 0 8px;
  font-size:21px;
  letter-spacing:-.025em;
}

.payref-card p{
  margin:0 0 12px;
  color:var(--muted);
  line-height:1.48;
  font-size:15px;
}

.payref-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:13px;
}

.payref-icon{
  width:54px;
  height:54px;
  border-radius:19px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(135deg,rgba(78,124,255,.18),rgba(139,77,255,.20));
  border:1px solid rgba(139,77,255,.22);
  box-shadow:0 12px 30px rgba(86,80,255,.14);
  font-size:24px;
}

.payref-badge{
  padding:8px 12px;
  border-radius:999px;
  background:rgba(117,240,189,.075);
  border:1px solid rgba(117,240,189,.22);
  color:#a8ffd9;
  font-size:13px;
  font-weight:850;
}

.payref-price-row{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:14px;
  margin:18px 0;
}

.payref-price{
  font-size:32px;
  font-weight:950;
  letter-spacing:-.04em;
  margin:8px 0 14px;
}

.payref-price small{
  display:block;
  color:var(--muted);
  font-size:14px;
  margin-top:6px;
  letter-spacing:0;
  font-weight:800;
}

.ref-url{
  display:flex;
  align-items:center;
  min-height:52px;
  font-size:13px;
  line-height:1.4;
  color:#dce3ff;
  margin:14px 0;
  padding:14px 16px;
  border-radius:17px;
  background:#11131b;
  border:1px solid var(--line-soft);
  word-break:break-all;
}

.toast{
  position:fixed;
  left:50%;
  bottom:24px;
  transform:translateX(-50%);
  z-index:9999;
  max-width:92%;
  padding:14px 18px;
  border-radius:17px;
  background:rgba(24,27,38,.96);
  border:1px solid rgba(139,77,255,.35);
  color:#fff;
  box-shadow:0 16px 44px rgba(0,0,0,.45);
  font-weight:850;
  backdrop-filter:blur(10px);
}

.paid-banner{
  margin-top:16px;
  padding:16px;
  border-radius:18px;
  background:rgba(117,240,189,.085);
  border:1px solid rgba(117,240,189,.24);
  color:#b8ffd9;
  font-weight:900;
}

.reinstall-btn{
  margin-top:12px;
}

.pay-msg{
  margin-top:10px;
  color:var(--muted);
  font-size:14px;
  line-height:1.4;
}

.login-processing:before{
  content:"Входим через Telegram…";
  position:fixed;
  inset:0;
  z-index:99999;
  display:grid;
  place-items:center;
  background:#101116;
  color:#fff;
  font-weight:900;
  font-size:20px;
}

@media(max-width:850px){
  .grid{
    grid-template-columns:1fr;
  }

  .mainTitle{
    font-size:32px;
  }

  .badge{
    display:none;
  }

  .stats{
    grid-template-columns:1fr 1fr;
  }

  .btn,
  a.btn,
  button.btn{
    width:100%;
  }

  .payref-grid{
    grid-template-columns:1fr;
  }

  .auth-actions{
    grid-template-columns:1fr;
  }
}

@media(max-width:640px){
  .wrap{
    padding:18px 12px 34px;
  }

  .hero{
    align-items:center;
    margin:2px 0 18px;
  }

  .logo-glass{
    width:88px;
    height:88px;
    border-radius:24px;
    padding:10px;
  }

  .logo img{
    width:66px;
    height:66px;
  }

  .brand{
    gap:12px;
  }

  .brand h1{
    font-size:30px;
  }

  .brand p{
    font-size:12px;
    margin-top:5px;
  }

  .card{
    border-radius:25px;
  }

  .pad{
    padding:18px;
  }

  .stats{
    gap:9px;
  }

  .stat{
    min-height:82px;
    padding:14px;
    border-radius:18px;
  }

  .btn,
  a.btn,
  button.btn{
    min-height:48px;
    font-size:14px!important;
    border-radius:15px!important;
    padding:11px 15px!important;
  }

  .auth-page h2{
    font-size:34px;
  }

  .payref-price{
    font-size:30px;
  }
}
