/* AdBot Pro: Telegram iOS look. All colours come from the Telegram theme; fallbacks match Telegram's defaults. */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #efeff4);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #000000);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --link: var(--tg-theme-link-color, #007aff);
  --accent: var(--tg-theme-button-color, #007aff);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --head: var(--tg-theme-section-header-text-color, #6d6d72);
  --danger: var(--tg-theme-destructive-text-color, #ff3b30);
  --sep: var(--tg-theme-section-separator-color, #c8c7cc);
  --safe-t: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-b: max(var(--tg-safe-area-inset-bottom, 0px), env(safe-area-inset-bottom, 0px));
  --ios: cubic-bezier(.32, .72, 0, 1);
  /* iOS settings icon colours */
  --c-red: #ff3b30; --c-orange: #ff9500; --c-yellow: #ffcc00; --c-green: #34c759; --c-teal: #30b0c7;
  --c-blue: #007aff; --c-indigo: #5856d6; --c-purple: #af52de; --c-pink: #ff2d55; --c-gray: #8e8e93;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--tg-theme-secondary-bg-color, #000000);
    --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #1c1c1d));
    --text: var(--tg-theme-text-color, #ffffff);
    --hint: var(--tg-theme-hint-color, #98989e);
    --link: var(--tg-theme-link-color, #3e88f7);
    --accent: var(--tg-theme-button-color, #3e88f7);
    --head: var(--tg-theme-section-header-text-color, #8d8e93);
    --sep: var(--tg-theme-section-separator-color, #38383a);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 400 17px/1.29 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, Roboto, "Segoe UI", sans-serif;
  letter-spacing: -.41px; -webkit-font-smoothing: antialiased; overscroll-behavior: none;
  user-select: none; -webkit-user-select: none; overflow-x: hidden;
}
button { font: inherit; letter-spacing: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
input, textarea { font: inherit; letter-spacing: inherit; color: inherit; user-select: text; -webkit-user-select: text; }
svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- page stack (push navigation like Telegram settings) */
#stage { position: relative; min-height: 100vh; min-height: var(--tg-viewport-stable-height, 100vh); overflow-x: hidden; }
.page { position: relative; width: 100%; min-height: 100vh; min-height: var(--tg-viewport-stable-height, 100vh); background: var(--bg);
  padding: calc(var(--safe-t) + 8px) 16px calc(94px + var(--safe-b)); }
.page.sub { padding-bottom: calc(32px + var(--safe-b)); }
.page.enter { animation: push-in .5s var(--ios) both; z-index: 2; }
.page.abs { position: absolute; left: 0; right: 0; }
.page.under { animation: under .5s var(--ios) both; }
.page.back-in { animation: back-in .5s var(--ios) both; }
.page.back-out { animation: back-out .45s var(--ios) both; z-index: 2; }
.page.fade { animation: fade .22s ease both; }
@keyframes push-in { from { transform: translateX(100%); box-shadow: -10px 0 30px rgba(0, 0, 0, .12); } }
@keyframes under { to { transform: translateX(-28%); opacity: .5; } }
@keyframes back-in { from { transform: translateX(-28%); opacity: .5; } }
@keyframes back-out { to { transform: translateX(100%); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- header block (Premium / Stars page style) */
.hdr { text-align: center; padding: 14px 8px 4px; }
.em { width: 110px; height: 110px; margin: 0 auto; display: grid; place-items: center; font-size: 84px; line-height: 1; }
.em.sm { width: 90px; height: 90px; font-size: 66px; }
.hdr h1 { margin: 10px 0 6px; font-size: 24px; line-height: 1.17; font-weight: 700; letter-spacing: .1px; }
.hdr p { margin: 0 auto; max-width: 320px; font-size: 15px; line-height: 1.33; letter-spacing: -.24px; }
.hdr p.h { color: var(--hint); }

/* ---------- sections */
.sh { margin: 24px 16px 7px; font-size: 13px; line-height: 1.38; text-transform: uppercase; letter-spacing: -.08px; color: var(--head); }
.sf { margin: 7px 16px 0; font-size: 13px; line-height: 1.38; letter-spacing: -.08px; color: var(--hint); }
.sf b { color: var(--text); font-weight: 400; }
.sec { background: var(--card); border-radius: 12px; overflow: hidden; }
.sec.gap { margin-top: 22px; }

.row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 44px; padding: 0 16px; position: relative; background: var(--card); transition: background .25s; }
.row.tap:active { background: color-mix(in srgb, var(--card) 86%, var(--text)); transition: none; }
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; height: 1px; transform: scaleY(.33); transform-origin: top; background: var(--sep); }
.sec.icons .row + .row::before { left: 59px; }
.sec.opts .row + .row::before { left: 52px; }
.row .t { flex: 1; min-width: 0; padding: 11px 0; }
.row .sub { display: block; margin-top: 2px; font-size: 15px; letter-spacing: -.24px; color: var(--hint); }
.row .sub.on { color: var(--c-green); }
.row .sub.warn { color: var(--c-orange); }
.row .v { color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 58%; }
.row .chev { width: 8px; height: 14px; flex: none; color: var(--hint); opacity: .6; stroke-width: 2.2; }
.row.act .t { color: var(--link); }
.row.dis { pointer-events: none; }
.row.dis .t, .row.dis .ico { opacity: .4; }
.ico { width: 29px; height: 29px; border-radius: 7px; display: grid; place-items: center; color: #fff; flex: none; }
.ico svg { width: 19px; height: 19px; stroke-width: 2; }
.ico.f svg { fill: #fff; stroke: none; }

/* plan options (Telegram Premium subscription rows) */
.opt { min-height: 60px; }
.opt .radio { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--sep); flex: none; display: grid; place-items: center; transition: background .2s, box-shadow .2s; }
.opt .radio svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 3; opacity: 0; transform: scale(.3); transition: .3s var(--ios); }
.opt.on .radio { background: var(--accent); box-shadow: none; }
.opt.on .radio svg { opacity: 1; transform: none; }
.opt .price { text-align: right; color: var(--hint); }
.badge { display: inline-block; vertical-align: 2px; margin-left: 7px; padding: 0 5px; border-radius: 5px; font-size: 12px; line-height: 18px; font-weight: 600; letter-spacing: 0; color: var(--accent-text); background: var(--accent); }
.feat { min-height: 52px; }
.feat .t { padding: 9px 0; }
.swap { animation: fade .28s ease both; }

/* iOS switch */
.sw { width: 51px; height: 31px; border-radius: 99px; background: color-mix(in srgb, var(--hint) 30%, transparent); position: relative; flex: none; transition: background .25s; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16); transition: transform .32s var(--ios); }
.sw.on { background: var(--c-green); }
.sw.on::after { transform: translateX(20px); }

/* edit field */
.inp { width: 100%; border: 0; outline: 0; background: transparent; padding: 11px 0; font-size: 17px; resize: none; caret-color: var(--accent); }
textarea.inp { height: 104px; }
.inp::placeholder { color: var(--hint); opacity: .75; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 15px; letter-spacing: 0; color: var(--link); }

/* profile header */
.ava { width: 100px; height: 100px; margin: 6px auto 0; border-radius: 50%; overflow: hidden; display: grid; place-items: center; color: #fff; font-size: 42px; font-weight: 600;
  background: linear-gradient(180deg, #72d5fd, #2a9ef1); }
.ava img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- tab bar (Telegram iOS) */
.tabs { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 4px 0 calc(var(--safe-b) + 4px); background: color-mix(in srgb, var(--card) 90%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 -.33px 0 var(--sep); transition: transform .45s var(--ios); }
.tabs.away { transform: translateY(110%); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 0 1px; color: var(--hint); font-size: 10px; font-weight: 500; letter-spacing: .1px; position: relative; text-align: center; }
.tab svg { width: 28px; height: 28px; stroke-width: 1.7; }
.tab.on { color: var(--accent); }
.tab.on svg .o { fill: currentColor; }
.tab.on svg { animation: tab-pop .35s var(--ios); }
.tab.on[data-tab=profile] svg circle:not(.o), .tab.on[data-tab=profile] svg path { stroke: var(--card); }
@keyframes tab-pop { 50% { transform: scale(.86); } }
.tab .dot { position: absolute; top: 2px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 1.5px var(--card); }

/* ---------- bottom sheet (Stars purchase style) */
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .4); opacity: 0; transition: opacity .35s ease; }
.sheet-back.show { opacity: 1; }
.sheet { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: calc(var(--tg-viewport-height, 100vh) - var(--safe-t) - 40px); overflow-y: auto;
  background: var(--bg); border-radius: 12px 12px 0 0; padding: 8px 16px calc(24px + var(--safe-b)); transform: translateY(100%);
  transition: transform .5s var(--ios); overscroll-behavior: contain; }
.sheet.show { transform: none; }
.sheet.drag { transition: none; }
.sheet-x { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--hint) 18%, transparent); color: var(--hint); }
.sheet-x svg { width: 12px; height: 12px; stroke-width: 2.6; }
.star { width: 22px; height: 22px; flex: none; }
.stars { display: flex; align-items: center; width: 50px; }
.stars .star + .star { margin-left: -14px; }
.stars .star { filter: drop-shadow(1.5px 0 0 var(--card)); }

/* ---------- toast (Telegram undo bar) */
.toast { position: fixed; z-index: 60; left: 8px; right: 8px; bottom: calc(var(--safe-b) + 66px); padding: 13px 16px; border-radius: 14px;
  background: rgba(30, 30, 30, .88); color: #fff; font-size: 15px; letter-spacing: -.24px;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  opacity: 0; transform: translateY(12px) scale(.98); transition: opacity .25s ease, transform .35s var(--ios); pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
body.subpage .toast, body.has-main .toast { bottom: calc(var(--safe-b) + 16px); }

.fallback-main { position: fixed; z-index: 50; left: 16px; right: 16px; bottom: calc(10px + var(--safe-b)); height: 50px; border-radius: 12px;
  background: var(--accent); color: var(--accent-text); font-weight: 600; font-size: 17px; text-align: center; }
body.no-tg.has-main .page { padding-bottom: calc(150px + var(--safe-b)); }
body.no-tg.has-main .sheet { padding-bottom: calc(84px + var(--safe-b)); }
body.no-tg.has-main .toast { bottom: calc(var(--safe-b) + 72px); }
body.no-tg.has-main .tabs { bottom: calc(66px + var(--safe-b)); }

.skel { height: 44px; border-radius: 12px; background: var(--card); margin-top: 10px; animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .5; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* payment method switch (iOS segmented control) */
.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; margin: 20px 0 0; padding: 2px; border-radius: 9px; background: color-mix(in srgb, var(--hint) 18%, transparent); }
.seg i { position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc(50% - 2px); border-radius: 7px; background: var(--card); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); transition: transform .32s var(--ios); }
.seg.r i { transform: translateX(100%); }
.seg button { position: relative; z-index: 1; height: 28px; text-align: center; font-size: 13px; font-weight: 600; letter-spacing: -.08px; }
.seg + .sec.gap { margin-top: 14px; }
.gram { width: 26px; height: 26px; flex: none; }
.coin { width: 90px; height: 90px; margin: 0 auto; display: grid; place-items: center; position: relative; }
.coin .gram { width: 76px; height: 76px; animation: coin-in .6s var(--ios) both; filter: drop-shadow(0 8px 16px rgba(0, 152, 234, .35)); }
@keyframes coin-in { from { transform: scale(.6) rotate(-20deg); opacity: 0; } }
.cp { width: 20px; height: 20px; flex: none; color: var(--accent); }
.spin { width: 20px; height: 20px; border-radius: 50%; border: 2.2px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
