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

html, body {
  min-height: 100%;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  z-index: 0;
}

/* ==================== AUTHENTIC TELEGRAM WALLPAPER BACKGROUNDS ==================== */
/* Fixed ::before layer with inset:-140px fixes iOS Safari background cutoff & rubber-band overscroll */
body::before {
  content: "";
  position: fixed;
  inset: -140px;
  z-index: -1;
  pointer-events: none;
  background-repeat: repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  background-size: 196px 196px, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
}

html:has(body.theme-a), body.theme-a {
  background-color: #9ec49f;
  color: #111827;
}

body.theme-a::before {
  background-color: #9ec49f;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='196' height='196' viewBox='0 0 196 196' fill='none' stroke='%23234d32' stroke-opacity='0.095' stroke-width='1.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 26l22-8-6 22-5-8-11-6zM38 18l-11 14'/%3E%3Cpath d='M68 22c0-5 4-8 9-8 4 0 7 2 8 6 4 0 7 3 7 7s-3 7-7 7H69c-4 0-7-3-7-6 0-3 2-6 6-6z'/%3E%3Crect x='114' y='14' width='18' height='30' rx='3.5'/%3E%3Cline x1='120' y1='39' x2='126' y2='39'/%3E%3Cpath d='M154 34l9-11 7 5 11-14M175 14h6v6'/%3E%3Ccircle cx='28' cy='76' r='11'/%3E%3Cpath d='M28 70v12M25 73c0-2 6-2 6 1s-6 2-6 4 6 2 6 1'/%3E%3Cpath d='M74 68l2.5 6.5 7 .8-5.2 4.5 1.7 6.8-6-3.6-6 3.6 1.7-6.8-5.2-4.5 7-.8z'/%3E%3Cpath d='M110 74h18v12c0 4-4 7-9 7s-9-3-9-7V74zM128 77h4c2 0 3 1.5 3 3.5S134 84 132 84h-4'/%3E%3Crect x='156' y='66' width='5' height='14' rx='1'/%3E%3Cline x1='158.5' y1='61' x2='158.5' y2='66'/%3E%3Cline x1='158.5' y1='80' x2='158.5' y2='86'/%3E%3Crect x='167' y='73' width='5' height='12' rx='1'/%3E%3Cline x1='169.5' y1='68' x2='169.5' y2='73'/%3E%3Cline x1='169.5' y1='85' x2='169.5' y2='90'/%3E%3Crect x='178' y='63' width='5' height='16' rx='1'/%3E%3Cline x1='180.5' y1='58' x2='180.5' y2='63'/%3E%3Cline x1='180.5' y1='79' x2='180.5' y2='84'/%3E%3Crect x='16' y='118' width='24' height='17' rx='2.5'/%3E%3Cpath d='M16 121l12 8 12-8'/%3E%3Ccircle cx='74' cy='126' r='11'/%3E%3Cpath d='M74 120v6l4 3'/%3E%3Cpath d='M114 124c0-6 5-10 11-10s11 4 11 10c0 7-11 15-11 15s-11-8-11-15z'/%3E%3Ccircle cx='125' cy='123' r='3.5'/%3E%3Cpath d='M160 120h22l-2.5 11h-17zM165 120v-3.5c0-2.5 2.5-4.5 6-4.5s6 2 6 4.5v3.5'/%3E%3Cpath d='M22 166l7-7 7 7-7 7z'/%3E%3Cpath d='M58 164h22v16H58zM69 164v16'/%3E%3Cpath d='M104 169l20-7-5.5 20-5-7.5-9.5-5.5z'/%3E%3Cpath d='M154 166c3-4 9-4 12 0 3-4 9-4 12 0 3 4 1 10-12 17-13-7-15-13-12-17z'/%3E%3Ccircle cx='54' cy='50' r='2.2'/%3E%3Ccircle cx='144' cy='48' r='2'/%3E%3Ccircle cx='50' cy='102' r='2'/%3E%3Ccircle cx='100' cy='102' r='2.5'/%3E%3Ccircle cx='144' cy='104' r='2'/%3E%3Ccircle cx='46' cy='154' r='2'/%3E%3Ccircle cx='142' cy='152' r='2.2'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 12% 10%, #dfe8b4 0%, transparent 48%),
    radial-gradient(ellipse at 88% 12%, #7bb091 0%, transparent 50%),
    radial-gradient(ellipse at 85% 90%, #dde6aa 0%, transparent 52%),
    radial-gradient(ellipse at 15% 88%, #73a98b 0%, transparent 50%),
    linear-gradient(135deg, #98c39b 0%, #c9daa8 50%, #86b794 100%);
}

html:has(body.theme-c), body.theme-c {
  background-color: #0b0f16;
  color: #f3f4f6;
}

body.theme-c::before {
  background-color: #0b0f16;
  background-size: 196px 196px, 100% 100%, 100% 100%, 100% 100%;
  background-repeat: repeat, no-repeat, no-repeat, no-repeat;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='196' height='196' viewBox='0 0 196 196' fill='none' stroke='%23ffffff' stroke-opacity='0.055' stroke-width='1.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 26l22-8-6 22-5-8-11-6zM38 18l-11 14'/%3E%3Cpath d='M68 22c0-5 4-8 9-8 4 0 7 2 8 6 4 0 7 3 7 7s-3 7-7 7H69c-4 0-7-3-7-6 0-3 2-6 6-6z'/%3E%3Crect x='114' y='14' width='18' height='30' rx='3.5'/%3E%3Cline x1='120' y1='39' x2='126' y2='39'/%3E%3Cpath d='M154 34l9-11 7 5 11-14M175 14h6v6'/%3E%3Ccircle cx='28' cy='76' r='11'/%3E%3Cpath d='M28 70v12M25 73c0-2 6-2 6 1s-6 2-6 4 6 2 6 1'/%3E%3Cpath d='M74 68l2.5 6.5 7 .8-5.2 4.5 1.7 6.8-6-3.6-6 3.6 1.7-6.8-5.2-4.5 7-.8z'/%3E%3Cpath d='M110 74h18v12c0 4-4 7-9 7s-9-3-9-7V74zM128 77h4c2 0 3 1.5 3 3.5S134 84 132 84h-4'/%3E%3Crect x='156' y='66' width='5' height='14' rx='1'/%3E%3Cline x1='158.5' y1='61' x2='158.5' y2='66'/%3E%3Cline x1='158.5' y1='80' x2='158.5' y2='86'/%3E%3Crect x='167' y='73' width='5' height='12' rx='1'/%3E%3Cline x1='169.5' y1='68' x2='169.5' y2='73'/%3E%3Cline x1='169.5' y1='85' x2='169.5' y2='90'/%3E%3Crect x='178' y='63' width='5' height='16' rx='1'/%3E%3Cline x1='180.5' y1='58' x2='180.5' y2='63'/%3E%3Cline x1='180.5' y1='79' x2='180.5' y2='84'/%3E%3Crect x='16' y='118' width='24' height='17' rx='2.5'/%3E%3Cpath d='M16 121l12 8 12-8'/%3E%3Ccircle cx='74' cy='126' r='11'/%3E%3Cpath d='M74 120v6l4 3'/%3E%3Cpath d='M114 124c0-6 5-10 11-10s11 4 11 10c0 7-11 15-11 15s-11-8-11-15z'/%3E%3Ccircle cx='125' cy='123' r='3.5'/%3E%3Cpath d='M160 120h22l-2.5 11h-17zM165 120v-3.5c0-2.5 2.5-4.5 6-4.5s6 2 6 4.5v3.5'/%3E%3Cpath d='M22 166l7-7 7 7-7 7z'/%3E%3Cpath d='M58 164h22v16H58zM69 164v16'/%3E%3Cpath d='M104 169l20-7-5.5 20-5-7.5-9.5-5.5z'/%3E%3Cpath d='M154 166c3-4 9-4 12 0 3-4 9-4 12 0 3 4 1 10-12 17-13-7-15-13-12-17z'/%3E%3Ccircle cx='54' cy='50' r='2.2'/%3E%3Ccircle cx='144' cy='48' r='2'/%3E%3Ccircle cx='50' cy='102' r='2'/%3E%3Ccircle cx='100' cy='102' r='2.5'/%3E%3Ccircle cx='144' cy='104' r='2'/%3E%3Ccircle cx='46' cy='154' r='2'/%3E%3Ccircle cx='142' cy='152' r='2.2'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 50% 0%, rgba(30, 58, 96, 0.36) 0%, transparent 58%),
    radial-gradient(ellipse at 85% 90%, rgba(240, 185, 11, 0.06) 0%, transparent 45%),
    linear-gradient(180deg, #0d121a 0%, #090c12 100%);
}

/* ==================== TOP BAR (1:1 REAL t.me HEADER) ==================== */
.tg-topbar {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.tg-topbar-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

body.theme-a .tg-topbar {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

body.theme-c .tg-topbar {
  background: rgba(24, 28, 36, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.tg-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-decoration: none;
  color: inherit;
}

.tg-logo-svg {
  width: 30px;
  height: 30px;
  display: block;
  flex-shrink: 0;
}

.tg-top-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 8px 18px;
  border-radius: 999px;
  background: #2481cc;
  color: #ffffff;
  transition: filter 0.12s ease;
}

.tg-top-action:hover {
  filter: brightness(1.07);
}

body.theme-c .tg-top-action {
  background: #2aabee;
  color: #ffffff;
}

/* ==================== STAGE & CARD ==================== */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 18px 14px 28px;
}

.tg-card {
  width: 100%;
  max-width: 440px;
  border-radius: 20px;
  padding: 28px 22px 24px;
  text-align: center;
}

body.theme-a .tg-card {
  background: #ffffff;
  box-shadow: 0 10px 32px rgba(15, 42, 28, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.85);
}

body.theme-c .tg-card {
  background: rgba(24, 30, 41, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.52);
}

/* ==================== IDENTITY (LARGE REAL t.me AVATAR) ==================== */
.ava {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  display: block;
  margin: 0 auto 14px;
}

body.theme-a .ava {
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
}

body.theme-c .ava {
  border: 2.5px solid #f0b90b;
  box-shadow: 0 0 0 4px rgba(240, 185, 11, 0.14), 0 6px 20px rgba(0, 0, 0, 0.45);
}

.ch-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

body.theme-a .ch-title { color: #111827; }
body.theme-c .ch-title { color: #ffffff; }

.ch-subs {
  font-size: 14px;
  margin-top: 4px;
}

body.theme-a .ch-subs { color: #6b7280; }
body.theme-c .ch-subs { color: #94a3b8; }

/* ==================== VARIANT A COPY ==================== */
.lead-line {
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  margin: 18px 0 13px;
  color: #111827;
}

.perk-list {
  list-style: none;
  text-align: left;
  font-size: 14.5px;
  line-height: 1.48;
  color: #374151;
  margin-bottom: 22px;
}

.perk-list li {
  margin-bottom: 7px;
}

.perk-list li:last-child {
  margin-bottom: 0;
}

.perk-list strong {
  color: #111827;
}

/* ==================== VARIANT C COPY ==================== */
.pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 15px 0 16px;
}

.pill {
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(240, 185, 11, 0.12);
  color: #f6d365;
  border: 1px solid rgba(240, 185, 11, 0.28);
}

.pill.hot {
  background: rgba(240, 185, 11, 0.24);
  color: #fde68a;
  border-color: rgba(240, 185, 11, 0.56);
}

.dark-desc {
  font-size: 15px;
  line-height: 1.46;
  color: #cbd5e1;
  text-align: center;
  margin-bottom: 22px;
}

.dark-desc strong {
  color: #ffffff;
}

/* ==================== PRIMARY CTA BUTTON (ABOVE BONUS BOX) ==================== */
.tg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 13px 20px;
  border-radius: 999px;
  background: #2481cc;
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(36, 129, 204, 0.28);
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.tg-btn:hover {
  filter: brightness(1.06);
}

.tg-btn:active {
  transform: scale(0.985);
}

body.theme-c .tg-btn {
  background: linear-gradient(135deg, #2aabee 0%, #1d8bd1 100%);
  box-shadow: 0 6px 20px rgba(42, 171, 238, 0.36);
}

.tg-subbtn {
  margin-top: 9px;
  font-size: 12.5px;
}

.tg-fallback {
  margin-top: 6px;
  font-size: 11.5px;
  line-height: 1.35;
}

.tg-fallback[hidden] { display: none; }

.tg-fallback a {
  color: #2aabee;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.theme-a .tg-subbtn, body.theme-a .tg-fallback { color: #6b7280; }
body.theme-c .tg-subbtn, body.theme-c .tg-fallback { color: #94a3b8; }

/* ==================== BORDERED BONUS BOX (UNIFORM 1px BORDER) ==================== */
.bonus-box {
  margin-top: 16px;
  border-radius: 13px;
  padding: 12px 14px;
  text-align: left;
  font-size: 13px;
  line-height: 1.42;
}

body.theme-a .bonus-box {
  background: #f0f8ff;
  border: 1px solid #cce7fb;
  color: #155e96;
}

body.theme-a .bonus-box strong {
  color: #0c4a6e;
}

body.theme-c .bonus-box {
  background: linear-gradient(135deg, rgba(42, 171, 238, 0.12) 0%, rgba(240, 185, 11, 0.07) 100%);
  border: 1px solid rgba(56, 189, 248, 0.32);
  color: #e2e8f0;
}

body.theme-c .bonus-box strong {
  color: #fde68a;
  font-size: 13.5px;
  display: block;
  margin-bottom: 3px;
}

/* ==================== DISCLAIMER FOOTER ==================== */
.tg-foot {
  width: 100%;
  max-width: 440px;
  margin-top: 14px;
  padding: 6px 12px;
  font-size: 10.5px;
  line-height: 1.4;
  text-align: center;
  border-radius: 10px;
}

body.theme-a .tg-foot {
  color: rgba(29, 58, 41, 0.72);
}

body.theme-c .tg-foot {
  color: #7c8aa0;
}

/* ==================== COMPACT BUDGET ANDROID (360x540 FB IN-APP BROWSER) ==================== */
@media (max-height: 640px) and (max-width: 460px) {
  .tg-topbar { height: 46px; }
  .tg-logo-svg { width: 25px; height: 25px; }
  .tg-brand { font-size: 16px; }
  .tg-top-action { padding: 6px 13px; font-size: 11px; }
  .stage { padding: 10px 10px 16px; }
  .tg-card { padding: 18px 15px 16px; border-radius: 16px; }
  .ava { width: 82px; height: 82px; margin-bottom: 8px; }
  .ch-title { font-size: 18px; }
  .ch-subs { font-size: 12.5px; }
  .lead-line { font-size: 13.5px; margin: 11px 0 9px; }
  .perk-list { font-size: 13px; margin-bottom: 14px; }
  .perk-list li { margin-bottom: 4px; }
  .pills { margin: 10px 0 11px; gap: 5px; }
  .pill { font-size: 11.5px; padding: 3.5px 9px; }
  .dark-desc { font-size: 13.5px; margin-bottom: 15px; }
  .tg-btn { min-height: 44px; padding: 10px 16px; font-size: 13.5px; }
  .bonus-box { margin-top: 11px; padding: 9px 11px; font-size: 12px; }
  .tg-foot { margin-top: 10px; font-size: 9.5px; }
}

/* ==================== DESKTOP (UPPER-CENTER OPTICAL BALANCE LIKE REAL t.me) ==================== */
@media (min-width: 640px) {
  .tg-topbar { height: 56px; padding: 0 24px; }
  .stage {
    padding: 44px 24px 48px;
  }
  .tg-card {
    max-width: 450px;
    padding: 34px 30px 30px;
    border-radius: 22px;
  }
  .ava {
    width: 124px;
    height: 124px;
    margin-bottom: 16px;
  }
  .ch-title { font-size: 24px; }
  .ch-subs { font-size: 14.5px; }
}

/* ==================== AUTO DARK MODE FOR VARIANT A (1:1 REAL t.me ON DARK PHONES) ==================== */
@media (prefers-color-scheme: dark) {
  html:has(body.theme-a), body.theme-a {
    background-color: #0e1116;
    color: #f3f4f6;
  }
  body.theme-a::before {
    background-color: #0e1116;
    background-size: 196px 196px, 100% 100%;
    background-repeat: repeat, no-repeat;
    background-image:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='196' height='196' viewBox='0 0 196 196' fill='none' stroke='%23ffffff' stroke-opacity='0.06' stroke-width='1.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 26l22-8-6 22-5-8-11-6zM38 18l-11 14'/%3E%3Cpath d='M68 22c0-5 4-8 9-8 4 0 7 2 8 6 4 0 7 3 7 7s-3 7-7 7H69c-4 0-7-3-7-6 0-3 2-6 6-6z'/%3E%3Crect x='114' y='14' width='18' height='30' rx='3.5'/%3E%3Cline x1='120' y1='39' x2='126' y2='39'/%3E%3Cpath d='M154 34l9-11 7 5 11-14M175 14h6v6'/%3E%3Ccircle cx='28' cy='76' r='11'/%3E%3Cpath d='M28 70v12M25 73c0-2 6-2 6 1s-6 2-6 4 6 2 6 1'/%3E%3Cpath d='M74 68l2.5 6.5 7 .8-5.2 4.5 1.7 6.8-6-3.6-6 3.6 1.7-6.8-5.2-4.5 7-.8z'/%3E%3Cpath d='M110 74h18v12c0 4-4 7-9 7s-9-3-9-7V74zM128 77h4c2 0 3 1.5 3 3.5S134 84 132 84h-4'/%3E%3Crect x='156' y='66' width='5' height='14' rx='1'/%3E%3Cline x1='158.5' y1='61' x2='158.5' y2='66'/%3E%3Cline x1='158.5' y1='80' x2='158.5' y2='86'/%3E%3Crect x='167' y='73' width='5' height='12' rx='1'/%3E%3Cline x1='169.5' y1='68' x2='169.5' y2='73'/%3E%3Cline x1='169.5' y1='85' x2='169.5' y2='90'/%3E%3Crect x='178' y='63' width='5' height='16' rx='1'/%3E%3Cline x1='180.5' y1='58' x2='180.5' y2='63'/%3E%3Cline x1='180.5' y1='79' x2='180.5' y2='84'/%3E%3Crect x='16' y='118' width='24' height='17' rx='2.5'/%3E%3Cpath d='M16 121l12 8 12-8'/%3E%3Ccircle cx='74' cy='126' r='11'/%3E%3Cpath d='M74 120v6l4 3'/%3E%3Cpath d='M114 124c0-6 5-10 11-10s11 4 11 10c0 7-11 15-11 15s-11-8-11-15z'/%3E%3Ccircle cx='125' cy='123' r='3.5'/%3E%3Cpath d='M160 120h22l-2.5 11h-17zM165 120v-3.5c0-2.5 2.5-4.5 6-4.5s6 2 6 4.5v3.5'/%3E%3Cpath d='M22 166l7-7 7 7-7 7z'/%3E%3Cpath d='M58 164h22v16H58zM69 164v16'/%3E%3Cpath d='M104 169l20-7-5.5 20-5-7.5-9.5-5.5z'/%3E%3Cpath d='M154 166c3-4 9-4 12 0 3-4 9-4 12 0 3 4 1 10-12 17-13-7-15-13-12-17z'/%3E%3Ccircle cx='54' cy='50' r='2.2'/%3E%3Ccircle cx='144' cy='48' r='2'/%3E%3Ccircle cx='50' cy='102' r='2'/%3E%3Ccircle cx='100' cy='102' r='2.5'/%3E%3Ccircle cx='144' cy='104' r='2'/%3E%3Ccircle cx='46' cy='154' r='2'/%3E%3Ccircle cx='142' cy='152' r='2.2'/%3E%3C/svg%3E"),
      linear-gradient(180deg, #0e1116 0%, #0b0d11 100%);
  }
  body.theme-a .tg-topbar {
    background: rgba(28, 31, 37, 0.96);
    border-bottom-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
  }
  body.theme-a .tg-card {
    background: #1c1f25;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.48);
  }
  body.theme-a .ch-title { color: #ffffff; }
  body.theme-a .ch-subs { color: #9ca3af; }
  body.theme-a .lead-line { color: #f3f4f6; }
  body.theme-a .perk-list { color: #d1d5db; }
  body.theme-a .perk-list strong { color: #ffffff; }
  body.theme-a .tg-subbtn { color: #9ca3af; }
  body.theme-a .bonus-box {
    background: rgba(42, 171, 238, 0.10);
    border-color: rgba(56, 189, 248, 0.28);
    color: #dbeafe;
  }
  body.theme-a .bonus-box strong { color: #ffffff; }
  body.theme-a .tg-foot { color: #8c96a6; }
}
