/* ===== Маяк VPN v2: Mini App ===== */
/* Одна колонка шириной с телефон при любом размере окна (Telegram Desktop, планшет, браузер) */
body.ma { font-size: 15.5px; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
body.ma .wrap { width: 100%; }

.ma-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; max-width: 560px; margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: linear-gradient(180deg, rgba(2, 10, 24, .92), rgba(2, 10, 24, .6) 70%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.ma-top .brand img { width: 32px; height: 32px; }
.ma-top .brand span { font-size: 16px; }
.ma-bal { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px;
  background: rgba(47, 139, 255, .12); border: 1px solid rgba(94, 166, 255, .3); color: var(--ink); font-size: 14px; font-weight: 600; }
.ma-bal svg { width: 16px; height: 16px; color: var(--hi); }
.ma-top .avatar { width: 36px; height: 36px; font-size: 15px; color: #fff; }

.ma-main { max-width: 560px; margin: 0 auto; padding: 6px 16px calc(112px + env(safe-area-inset-bottom)); gap: 14px; }
.ma-main .page-title { margin-top: 4px; }
.ma-main .page-title h2 { font-size: 24px; }
.ma-main .card, .ma-main .plan, .ma-main .sub-hero { padding: 20px; }
.ma-main .sub-hero { min-height: 0; border-radius: 26px; }
.ma-main .sub-hero .when { font-size: 28px; }
.ma-main .ring { width: 96px; height: 96px; }
.ma-main .ring > div { width: 78px; height: 78px; }
.ma-main .ring b { font-size: 24px; }
.ma-main .grid-2, .ma-main .grid-3 { grid-template-columns: minmax(0, 1fr); gap: 14px; }
.ma-main .plans { grid-template-columns: minmax(0, 1fr); gap: 14px; }
.ma-main .row { flex-wrap: wrap; }
.ma-main .row .grow { flex: 1 1 150px; }
.ma-main .key-line .btn { padding: 0 12px; }

.ma-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.ma-btns .btn { flex: 1 1 140px; }
.ma-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.ma-pair .card { padding: 16px; }
.ma-big { font-size: 24px; margin: 6px 0 12px; line-height: 1.15; }
.ma-pair .ma-big .muted { display: block; font-size: 13px; margin-top: 2px; }
.ma-big .muted { font-size: 14px; }
.ma-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ma-stats .card { padding: 14px; }
.ma-stats .ma-big { margin-bottom: 0; }
@media (max-width: 360px) { .ma-pair, .ma-stats { grid-template-columns: minmax(0, 1fr); } }

/* баланс и автопродление в одну колонку */
.ma-main .wallet { grid-template-columns: minmax(0, 1fr); }
.ma-main .wallet-bal, .ma-main .wallet-auto { padding: 18px 20px; }
.ma-main .wallet-auto { border-left: 0; border-top: 1px solid var(--line); }
.ma-main .wallet-act { margin-left: 0; width: 100%; }
.ma-main .wallet-act .btn { flex: 1; }
.ma-main .switch { width: 52px; height: 30px; }
.ma-main .switch input { border: 1px solid rgba(160, 190, 255, .22); background: rgba(255, 255, 255, .1); }
.ma-main .switch input:checked { border-color: transparent; background: var(--signal); }
.ma-main .switch::after { top: 4px; left: 4px; width: 22px; height: 22px; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.ma-main .switch:has(input:checked)::after { transform: translateX(22px); }
/* автопродление без тарифа: выключатель серый с замком, по нажатию — подсказка */
.ma-main .switch.locked input { background: rgba(255, 255, 255, .05); border-style: dashed; }
.ma-main .switch.locked::after { background: rgba(200, 215, 240, .45) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23071731' stroke-width='2.4' stroke-linecap='round'%3E%3Crect x='6' y='11' width='12' height='9' rx='2'/%3E%3Cpath d='M9 11V8a3 3 0 016 0v3'/%3E%3C/svg%3E") center / 13px no-repeat; }
.ma-main .wallet-auto:has(.locked) { opacity: 1; cursor: pointer; }
.ma-main .wallet-auto a { color: var(--signal-2); white-space: nowrap; }

/* строка-ссылка: иконка, текст, стрелка */
.ma-link { display: flex; align-items: center; gap: 14px; color: inherit; text-align: left; width: 100%; cursor: pointer; font: inherit; }
.ma-link .ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: rgba(47, 139, 255, .16); color: var(--hi); flex: none; }
.ma-link .ic svg { width: 22px; height: 22px; }
.ma-link .grow { flex: 1; min-width: 0; }
.chev { width: 18px; height: 18px; color: var(--faint, rgba(200, 215, 240, .45)); flex: none; }
.ma-main .list .row > .chev { margin-left: auto; }

/* профиль */
.ma-me { display: flex; align-items: center; gap: 16px; }
.avatar-lg { width: 60px; height: 60px; font-size: 24px; color: #fff; }
.ma-me h3 { font-size: 20px; }

/* установка */
.ma-main .setup { padding: 18px; }
.ma-main .app-tabs { grid-auto-columns: minmax(124px, 1fr); }
.ma-main .plat-pick { min-width: 0; flex: 1; }
.ma-qr summary { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--signal-2); list-style: none; }
.ma-qr summary::-webkit-details-marker { display: none; }
.ma-qr summary svg { width: 18px; height: 18px; }
.ma-qr .setup-qr { margin-top: 14px; }
.ma-qr .qr { background: linear-gradient(150deg, #d3e3ff, #a7c6ff); border: 1px solid rgba(94, 166, 255, .55); border-radius: 18px; padding: 12px; box-shadow: 0 10px 34px rgba(47, 139, 255, .22); }

/* чат занимает экран над вкладками */
.ma-main .chat { height: calc(var(--tg-viewport-stable-height, 100vh) - 190px - env(safe-area-inset-bottom)); min-height: 360px; border-radius: 24px; }
.ma-main .msg { max-width: 88%; }

/* статусы оплаты, заглушки */
.ma-center { text-align: center; padding: 40px 24px; display: grid; gap: 16px; justify-items: center; }
.ma-okic { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: rgba(61, 220, 151, .15); color: var(--ok); }
.ma-okic svg { width: 34px; height: 34px; }
.ma-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.ma-gate > div { max-width: 420px; width: 100%; border-radius: 28px; }
.ma-gate .lighthouse { margin: 0 auto 6px; }

/* нижние вкладки — всегда */
body.ma .tabbar { background: var(--glass-strong); display: flex; position: fixed; z-index: 40; left: 50%; translate: -50% 0; width: min(528px, calc(100% - 24px));
  bottom: calc(10px + env(safe-area-inset-bottom)); padding: 6px; border-radius: 24px; justify-content: space-around; }
body.ma .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 16px; color: var(--muted); font-size: 11px; flex: 1; position: relative; transition: background .2s, color .2s; }
body.ma .tabbar a svg { width: 22px; height: 22px; }
body.ma .tabbar a.on { color: #fff; background: rgba(47, 139, 255, .2); }
body.ma .tabbar .badge-n { position: absolute; top: 2px; right: 18%; min-width: 18px; height: 18px; font-size: 11px; }

/* модалки снизу, как шторка */
body.ma .modal-bg { align-items: end; padding: 0; }
body.ma .modal { width: min(560px, 100%); border-radius: 26px 26px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); max-height: 88vh; animation: sheet .26s cubic-bezier(.2, .9, .3, 1); }
@keyframes sheet { from { translate: 0 40px; opacity: 0; } }
body.ma .modal .seg { width: 100%; flex-wrap: nowrap; overflow-x: auto; }
body.ma .modal .seg button { flex: 1 0 auto; }
body.ma .toasts { bottom: calc(96px + env(safe-area-inset-bottom)); }
body.ma .demo-flag { bottom: calc(92px + env(safe-area-inset-bottom)); left: 50%; translate: -50% 0; white-space: nowrap; animation: demo-hide 6s forwards; }
@keyframes demo-hide { 0%, 80% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }

/* без «прыжков» масштаба на iPhone */
body.ma input, body.ma select, body.ma textarea, body.ma .input { font-size: 16px !important; }

/* объявления на обзоре */
.ma-notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 18px; background: rgba(47, 139, 255, .12); border: 1px solid rgba(94, 166, 255, .35); }
.ma-notice svg { width: 20px; height: 20px; flex: none; margin-top: 2px; color: var(--hi); }
.ma-notice p { margin: 0; font-size: 14.5px; }
.ma-notice.warn { background: rgba(255, 90, 95, .1); border-color: rgba(255, 90, 95, .35); }
.ma-notice.warn svg { color: #ffadb0; }
.ma-notice.gift { background: rgba(61, 220, 151, .08); border-color: rgba(61, 220, 151, .3); }
.ma-notice.gift svg { color: var(--ok); }
.chip .ci { width: 14px; height: 14px; display: inline; vertical-align: -2px; margin-right: 4px; }
.ma-how li { padding-bottom: 14px; }
.ma-how li p { margin: 4px 0 0; }

/* ряд приложений: рамка и подсветка выбранного не обрезаются по краям */
/* все приложения платформы видны сразу, без прокрутки: 2–3 в ряд, 4 — сеткой 2×2 */
.ma-main .app-tabs.fit { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); overflow: visible; gap: 8px; padding: 0; margin: 0; }
.ma-main .app-tabs.fit .app-tab { height: 52px; padding: 0 12px; min-width: 0; }
.ma-main .app-tabs.fit .app-tab .nm { font-size: clamp(13.5px, 3.8vw, 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ma-main .app-tabs.fit .app-tab .wm { font-size: 40px; right: -6px; }
.ma-main .app-tabs.fit .app-tab .rec { top: 6px; left: 6px; }

.ma-notice p { flex: 1; min-width: 0; }
.ma-x { flex: none; width: 28px; height: 28px; margin: -4px -6px -4px 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.ma-x svg { width: 16px; height: 16px; margin: 0; color: currentColor; }
.ma-x:active { background: rgba(255,255,255,.08); }

/* экран согласия */
.consent { gap: 14px; text-align: center; }
.consent h2 { font-size: 22px; }
.consent > p { text-align: left; line-height: 1.55; }
.consent-docs { display: grid; gap: 8px; width: 100%; text-align: left; }
.consent-docs .row { padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255,255,255,.03); display: flex; gap: 12px; align-items: center; }
.consent-docs .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(47,139,255,.14); color: var(--hi); flex: none; }
.consent-docs .ic svg { width: 18px; height: 18px; }
.consent .btn-block { width: 100%; }

/* акция с таймером */
.plan.sale { border-color: rgba(255, 196, 77, .45); }
.sale-timer { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 6px 12px; border-radius: 999px; font-size: 13px; color: #ffd27a; background: rgba(255, 196, 77, .1); border: 1px solid rgba(255, 196, 77, .35); }
.sale-timer svg { width: 15px; height: 15px; }
.sale-timer b { font-variant-numeric: tabular-nums; }
/* подарки */
.gift-how { display: grid; gap: 12px; }
.gift-how > div { display: flex; gap: 12px; align-items: center; }
.gift-how .n { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: rgba(47, 139, 255, .18); color: var(--hi); }

/* выбор числа устройств */
.dev-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-top: 16px; }
.dev-row .grow { display: grid; gap: 2px; min-width: 0; }
.stepper { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.stepper button { width: 36px; height: 36px; border-radius: 10px; border: 0; background: rgba(47,139,255,.18); color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; }
.stepper button:disabled { opacity: .35; cursor: default; }
.stepper b { min-width: 32px; text-align: center; font-size: 18px; }
/* заморозка */
.ma-textlink { margin-top: 14px; background: none; border: 0; padding: 0; color: var(--signal-2, #7fb8ff); font: inherit; font-size: 14px; cursor: pointer; }
.sub-hero.frozen { background: linear-gradient(135deg, rgba(120,200,255,.16), rgba(47,139,255,.05)); border-color: rgba(140,210,255,.35); }
a.ma-notice { color: inherit; text-decoration: none; }

/* устройства */
.dev-slots { display: flex; gap: 6px; margin: 2px 0 14px; }
.dev-slots i { flex: 1; height: 6px; border-radius: 99px; background: rgba(255,255,255,.08); }
.dev-slots i.on { background: linear-gradient(90deg, #2f8bff, #5ea6ff); box-shadow: 0 0 10px rgba(47,139,255,.45); }
.dev-list { display: grid; gap: 8px; }
.dev-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: rgba(255,255,255,.035); border: 1px solid var(--line); }
.dev-item.fresh { border-color: rgba(94,166,255,.55); background: linear-gradient(135deg, rgba(47,139,255,.14), rgba(47,139,255,.03)); }
.dev-item .grow { min-width: 0; display: grid; gap: 2px; }
.dev-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dev-name .chip { flex: none; padding: 2px 8px; font-size: 11px; }
.dev-ic { width: 42px; height: 42px; flex: none; border-radius: 13px; display: grid; place-items: center; background: rgba(255,255,255,.07); }
.dev-ic svg { width: 21px; height: 21px; }
.dev-ic.ios, .dev-ic.mac { background: linear-gradient(135deg, rgba(220,226,240,.22), rgba(160,170,190,.08)); }
.dev-ic.android { background: linear-gradient(135deg, rgba(61,220,132,.22), rgba(61,220,132,.06)); color: #6ff0a8; }
.dev-ic.win { background: linear-gradient(135deg, rgba(0,164,239,.25), rgba(0,120,215,.06)); color: #5cc7ff; }
.dev-ic.tv, .dev-ic.other { background: linear-gradient(135deg, rgba(170,140,255,.22), rgba(120,90,220,.06)); color: #c3b2ff; }
.dev-safe { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.03); font-size: 13px; color: var(--muted, #9fb0cc); }
.dev-safe svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--hi); }

/* оценка поддержки */
.rate-box { display: grid; justify-items: center; gap: 6px; padding: 14px; margin: 0 12px 10px; border-radius: 16px; background: linear-gradient(135deg, rgba(255,196,77,.12), rgba(255,196,77,.03)); border: 1px solid rgba(255,196,77,.3); text-align: center; }
.rate-box.done { display: flex; justify-content: center; gap: 10px; align-items: center; font-size: 14px; }
.rate-stars { display: flex; gap: 6px; }
.rate-stars button { width: 44px; height: 44px; border: 0; border-radius: 12px; background: rgba(255,255,255,.06); color: rgba(255,255,255,.25); font-size: 26px; line-height: 1; cursor: pointer; transition: transform .15s, color .15s, background .15s; }
.rate-stars button.on { color: #ffc94d; background: rgba(255,196,77,.16); transform: scale(1.06); }
.rate-stars.static { color: #ffc94d; font-size: 18px; letter-spacing: 2px; }
.rate-stars.static i { color: rgba(255,255,255,.2); font-style: normal; }
.ma-blocked-ic { width: 76px; height: 76px; border-radius: 24px; display: grid; place-items: center; font-size: 36px; background: rgba(255,90,95,.12); border: 1px solid rgba(255,90,95,.3); box-shadow: 0 0 30px rgba(255,90,95,.18); }
@media (max-width: 360px) { .ma-btns .btn { white-space: normal; text-align: center; line-height: 1.25; padding-left: 14px; padding-right: 14px; } }

/* ---------- Колесо подарков ---------- */
.wh-tip { position: fixed; z-index: 39; left: 50%; translate: -50% 0; bottom: calc(96px + env(safe-area-inset-bottom)); width: min(528px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 12px; border-radius: 20px; background: rgba(9, 22, 50, .96); border: 1px solid var(--line-strong); box-shadow: var(--shadow); animation: whIn .35s cubic-bezier(.2, .9, .3, 1); }
@keyframes whIn { from { opacity: 0; transform: translateY(12px); } }
.wh-mini { width: 40px; height: 40px; flex: none; position: relative; }
/* мини-колесо: раскручивается, замедляется и «щёлкает» на призе, пауза — и снова (цикл 5 с) */
.wh-mini i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(156, 201, 255, .5);
  background: conic-gradient(from -22.5deg, #0f2c63 0 45deg, #1b4fa8 0 90deg, #0f2c63 0 135deg, #2f8bff 0 180deg, #0f2c63 0 225deg, #1b4fa8 0 270deg, #0f2c63 0 315deg, #5ea6ff 0);
  animation: whTease 5s infinite; }
.wh-mini i::after { content: ''; position: absolute; inset: 13px; border-radius: 50%; background: var(--beam); box-shadow: 0 0 8px var(--beam); }
.wh-mini::before { content: ''; position: absolute; z-index: 1; left: 50%; top: -5px; translate: -50% 0; border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 9px solid var(--beam); filter: drop-shadow(0 1px 3px rgba(255, 213, 138, .7)); animation: whTick 5s infinite; transform-origin: 50% 0; }
@keyframes whTease {
  0% { rotate: 0deg; animation-timing-function: cubic-bezier(.12, .55, .2, 1); }
  46% { rotate: 1092deg; animation-timing-function: ease-in-out; }
  54% { rotate: 1080deg; }
  100% { rotate: 1080deg; }
}
@keyframes whTick { 0%, 40% { transform: none; } 47% { transform: rotate(-18deg); } 54% { transform: rotate(6deg); } 60%, 100% { transform: none; } }
.wh-tip .t { flex: 1; min-width: 0; display: grid; gap: 1px; } .wh-tip b { font-size: 14px; } .wh-tip .t span { font-size: 12px; color: var(--muted); }
.wh-tip .btn { padding: 8px 14px; min-height: 0; font-size: 13px; flex: none; }
.wh-x { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--muted); background: transparent; border: 0; font-size: 16px; line-height: 1; cursor: pointer; }
.wh-sheet { text-align: center; }
.wh-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; text-align: left; }
.wh-head h3 { font-family: var(--display); font-size: 20px; }
.wh-wrap { position: relative; margin: 18px auto 6px; }
.wh-svg { display: block; border-radius: 50%; box-shadow: 0 0 0 6px rgba(47, 139, 255, .12), 0 0 50px rgba(47, 139, 255, .35); transition: transform 4.2s cubic-bezier(.15, .85, .2, 1); }
.wh-hub { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; translate: -50% -50%; border-radius: 50%; display: grid; place-items: center; font-size: 24px;
  background: radial-gradient(circle at 35% 30%, #16397a, #061634); border: 2px solid rgba(156, 201, 255, .55); box-shadow: 0 4px 18px rgba(0, 0, 0, .5); }
.wh-pin { position: absolute; left: 50%; top: -10px; translate: -50% 0; width: 0; height: 0; border-left: 13px solid transparent; border-right: 13px solid transparent; border-top: 24px solid var(--beam); filter: drop-shadow(0 2px 6px rgba(255, 213, 138, .6)); }
.wh-note { font-size: 12.5px; color: var(--faint); margin-top: 10px; }
.wh-prize { margin: 6px 0 4px; font-family: var(--display); font-size: 24px; color: #fff; }
.wh-chances { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.wh-chances span { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: var(--muted); }
.wh-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--beam); box-shadow: 0 0 8px var(--beam); flex: none; }
@media (prefers-reduced-motion: reduce) { .wh-mini i, .wh-mini::before { animation: none; } }

/* «Почему выключаете автопродление?» */
.ap-reasons { display: grid; gap: 8px; margin-top: 16px; }
.ap-r { text-align: left; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; }
.ap-r.on { border-color: var(--signal); background: rgba(47, 139, 255, .14); }
.ap-why textarea { margin-top: 10px; min-height: 80px; }
