:root {
  color-scheme: dark;
  --ink: #f7f8ff;
  --muted: #979db8;
  --line: rgba(255, 255, 255, 0.09);
  --panel: rgba(21, 24, 46, 0.88);
  --gold: #f7c94d;
  --gold-soft: #ffe98d;
  --navy: #080a18;
  --success: #55dc93;
  --danger: #ff8b94;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; background: var(--navy); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--navy);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.hidden { display: none !important; }

.app-shell {
  position: relative;
  min-height: 100vh;
  min-height: var(--tg-viewport-stable-height, 100vh);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -8%, rgba(90, 75, 214, 0.25), transparent 35%),
    linear-gradient(180deg, #101329 0%, #080a18 48%, #070914 100%);
}
.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  opacity: .24;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 20%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 78% 13%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 85% 45%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 23% 60%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 64% 76%, #fff 0 1px, transparent 1.5px);
  background-size: 190px 230px, 270px 210px, 230px 260px, 310px 290px, 250px 280px;
}
.ambient { position: fixed; width: 260px; height: 260px; border-radius: 50%; filter: blur(95px); pointer-events: none; }
.ambient-one { top: 12%; left: -190px; background: rgba(83, 100, 255, .24); }
.ambient-two { right: -210px; top: 54%; background: rgba(247, 201, 77, .13); }

.mobile-frame {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  margin: 0 auto;
  padding:
    calc(max(18px, env(safe-area-inset-top)) + var(--tg-content-safe-area-inset-top, 0px))
    max(18px, env(safe-area-inset-right))
    calc(34px + env(safe-area-inset-bottom) + var(--tg-content-safe-area-inset-bottom, 0px))
    max(18px, env(safe-area-inset-left));
}
.topbar, .brand, .card-head, .section-title, .subscription-meta, .payment-button { display: flex; align-items: center; }
.topbar { justify-content: space-between; margin-bottom: 23px; }
.brand { gap: 12px; }
.star-mark {
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  border: 1px solid rgba(255, 230, 132, .38);
  border-radius: 15px;
  color: #171528;
  font-size: 24px;
  background: linear-gradient(145deg, #fff1a4, #e8ad26);
  box-shadow: 0 8px 28px rgba(247, 201, 77, .25), inset 0 1px rgba(255,255,255,.72);
  transform: rotate(-4deg);
}
.star-mark span { transform: rotate(4deg); }
.eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.brand h1 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.profile-dot { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; color: #171528; font-weight: 850; background: linear-gradient(145deg, #fce787, #c9921d); box-shadow: 0 5px 20px rgba(0,0,0,.22); }

.subscription-card {
  position: relative;
  overflow: hidden;
  padding: 21px;
  border: 1px solid rgba(248, 217, 111, .21);
  border-radius: 27px;
  background: linear-gradient(145deg, rgba(37, 40, 78, .94), rgba(18, 20, 40, .96)), var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .32), inset 0 1px rgba(255,255,255,.05);
}
.subscription-card::after { content: "★"; position: absolute; right: -20px; top: 26px; color: rgba(247, 201, 77, .045); font-size: 190px; line-height: 1; transform: rotate(12deg); }
.subscription-card.inactive { border-color: rgba(255,255,255,.1); }
.subscription-card.inactive .shield { color: #8b91aa; border-color: rgba(255,255,255,.1); background: rgba(255,255,255,.04); }
.subscription-card.inactive .status-pill { color: #b2b7cc; border-color: rgba(255,255,255,.1); background: rgba(255,255,255,.045); }
.subscription-card.inactive .status-pill i { background: #7e849d; box-shadow: none; }
.card-head { position: relative; z-index: 1; justify-content: space-between; }
.card-head h2 { margin: 10px 0 0; font-size: 26px; letter-spacing: -.04em; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid rgba(91, 226, 151, .18); border-radius: 99px; color: #8cf0b5; font-size: 11px; font-weight: 750; background: rgba(28, 142, 87, .13); }
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 13px var(--success); }
.shield { display: grid; place-items: center; width: 52px; height: 58px; color: var(--gold-soft); font-size: 27px; border-radius: 18px 18px 24px 24px; background: linear-gradient(150deg, rgba(247,201,77,.22), rgba(247,201,77,.06)); border: 1px solid rgba(247,201,77,.22); }
.subscription-meta { position: relative; z-index: 1; gap: 44px; margin-top: 27px; }
.subscription-meta div { display: grid; gap: 5px; min-width: 0; }
.subscription-meta span { color: var(--muted); font-size: 12px; }
.subscription-meta strong { font-size: 15px; }
.progress-track { position: relative; z-index: 1; height: 5px; margin-top: 22px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.08); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #e8ad26, #fff09a); box-shadow: 0 0 16px rgba(247,201,77,.6); transition: width .45s ease; }
.days-left { position: relative; z-index: 1; margin: 8px 0 19px; color: var(--muted); font-size: 11px; text-align: right; }
.connect-button { position: relative; z-index: 1; width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 14px 15px 14px 17px; border: 1px solid rgba(247,201,77,.19); border-radius: 16px; color: #ffe988; font-size: 13px; font-weight: 750; background: rgba(247,201,77,.075); }
.connect-button b { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; color: #171528; background: var(--gold); }
.inactive-hint { position: relative; z-index: 1; margin: 17px 0 0; padding: 13px 14px; border: 1px solid rgba(255,255,255,.07); border-radius: 14px; color: #b6bbd0; font-size: 12px; line-height: 1.45; background: rgba(255,255,255,.035); }

.plans-section { margin-top: 30px; }
.section-title { justify-content: space-between; margin-bottom: 14px; }
.section-title h2, .payment-section h2 { margin: 2px 0 0; font-size: 22px; letter-spacing: -.035em; }
.section-title > span { align-self: end; color: var(--muted); font-size: 12px; }
.plans-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.plan-card { position: relative; min-height: 126px; padding: 17px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); text-align: left; background: rgba(20, 23, 44, .82); transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.plan-card:active { transform: scale(.98); }
.plan-card.selected { border-color: rgba(247,201,77,.65); background: linear-gradient(145deg, rgba(74,62,39,.45), rgba(25,27,47,.93)); box-shadow: inset 0 0 0 1px rgba(247,201,77,.08), 0 12px 34px rgba(0,0,0,.19); }
.plan-name { display: block; margin-bottom: 10px; color: #d5d8e8; font-size: 12px; font-weight: 700; }
.plan-card strong { display: block; font-size: 23px; letter-spacing: -.035em; }
.plan-card small { display: block; max-width: calc(100% - 25px); margin-top: 7px; color: var(--muted); font-size: 10px; }
.radio { position: absolute; right: 14px; bottom: 14px; width: 18px; height: 18px; border: 1.5px solid #575c76; border-radius: 50%; }
.selected .radio { border-color: var(--gold); }
.selected .radio em { display: block; width: 8px; height: 8px; margin: 4px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 9px rgba(247,201,77,.65); }
.popular-badge { position: absolute; right: 13px; top: 13px; padding: 4px 7px; border-radius: 7px; color: #171528; font-size: 9px; font-weight: 900; letter-spacing: .08em; background: var(--gold); }
.old-price { margin-left: 5px; color: #727891; font-size: 10px; font-weight: 500; text-decoration: line-through; }

.payment-section { margin-top: 31px; }
.payment-section h2 { margin-bottom: 14px; }
.payment-button { width: 100%; gap: 13px; margin-top: 9px; padding: 13px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); text-align: left; background: rgba(20, 23, 44, .82); }
.payment-button:active { transform: scale(.99); }
.payment-button:disabled { opacity: .55; cursor: wait; }
.payment-icon { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: 14px; font-weight: 900; }
.sbp-icon { color: white; font-size: 11px; background: linear-gradient(145deg, #17c68b, #586cf6); }
.stars-icon { color: #1b1827; font-size: 24px; background: linear-gradient(145deg, #ffe990, #e6ab24); }
.payment-copy { display: grid; flex: 1; gap: 4px; }
.payment-copy b { font-size: 14px; }
.payment-copy small { color: var(--muted); font-size: 11px; }
.arrow { color: #6f7591; font-size: 27px; font-weight: 300; }
.secure-note { display: flex; justify-content: center; gap: 7px; margin: 14px 0 0; color: #777d98; font-size: 10px; text-align: center; }
.secure-note span { color: #69d99b; font-weight: 800; }
footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 29px; color: #5e647f; font-size: 11px; }
footer a { color: #7f859f; text-decoration: none; }

.state-view { position: relative; z-index: 3; min-height: var(--tg-viewport-stable-height, 100vh); display: flex; flex-direction: column; align-items: center; justify-content: center; width: min(100%, 480px); margin: 0 auto; padding: 32px 26px; text-align: center; }
.state-view h1 { margin: 18px 0 8px; font-size: 25px; letter-spacing: -.035em; }
.state-view p { max-width: 330px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.loading-star, .error-star { display: grid; place-items: center; width: 76px; height: 76px; border: 1px solid rgba(255,230,132,.38); border-radius: 25px; color: #171528; font-size: 42px; background: linear-gradient(145deg, #fff1a4, #e8ad26); box-shadow: 0 20px 55px rgba(247,201,77,.22); animation: float 2s ease-in-out infinite; }
.error-star { color: #3a1520; background: linear-gradient(145deg, #ffc5ca, #ff737e); box-shadow: 0 20px 55px rgba(255,115,126,.15); animation: none; }
@keyframes float { 50% { transform: translateY(-7px) rotate(3deg); } }
.loader { width: 150px; height: 4px; margin-top: 24px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.07); }
.loader i { display: block; width: 50%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, transparent, var(--gold), transparent); animation: load 1.2s ease-in-out infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(200%); } }
.primary-button { width: min(100%, 330px); min-height: 49px; margin-top: 22px; border: 0; border-radius: 16px; color: #171528; font-weight: 800; background: linear-gradient(135deg, #ffe98d, #e5ad2c); }
.text-link { margin-top: 16px; color: #c6cae0; font-size: 13px; }

.sheet-backdrop { position: fixed; z-index: 20; inset: 0; display: flex; align-items: end; justify-content: center; padding-top: 80px; background: rgba(4,5,12,.74); backdrop-filter: blur(7px); }
.payment-sheet { position: relative; width: min(100%, 520px); padding: 11px 22px calc(24px + env(safe-area-inset-bottom) + var(--tg-content-safe-area-inset-bottom, 0px)); border: 1px solid rgba(255,255,255,.11); border-bottom: 0; border-radius: 29px 29px 0 0; text-align: center; background: linear-gradient(180deg, #1a1d39, #0d0f21); box-shadow: 0 -25px 80px rgba(0,0,0,.45); animation: rise .25s ease-out; }
@keyframes rise { from { transform: translateY(28px); opacity: 0; } }
.sheet-handle { width: 40px; height: 4px; margin: 0 auto 18px; border-radius: 99px; background: #4b5067; }
.sheet-close { position: absolute; right: 17px; top: 20px; width: 31px; height: 31px; border: 0; border-radius: 50%; color: #a8adc3; font-size: 23px; line-height: 1; background: rgba(255,255,255,.07); }
.sheet-icon { display: grid; place-items: center; width: 62px; height: 62px; margin: 8px auto 17px; border-radius: 21px; font-weight: 900; }
.sheet-icon.sbp { color: white; font-size: 14px; background: linear-gradient(145deg, #17c68b, #586cf6); }
.sheet-icon.stars { color: #171528; font-size: 34px; background: linear-gradient(145deg, #fff1a4, #e8ad26); box-shadow: 0 12px 36px rgba(247,201,77,.22); }
.payment-sheet h2 { margin: 6px 0 8px; font-size: 32px; letter-spacing: -.045em; }
.sheet-description { max-width: 390px; margin: 0 auto 14px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.sheet-order { margin: 0 auto 14px; color: #777d98; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.sheet-status { margin: 0 0 14px; padding: 11px 13px; border: 1px solid rgba(247,201,77,.14); border-radius: 13px; color: #e7d88f; font-size: 12px; line-height: 1.4; background: rgba(247,201,77,.055); }
.sheet-status.success { color: #91edb8; border-color: rgba(85,220,147,.2); background: rgba(85,220,147,.07); }
.sheet-status.error { color: #ffafb5; border-color: rgba(255,139,148,.18); background: rgba(255,139,148,.07); }
.sheet-primary, .sheet-secondary { width: 100%; min-height: 50px; border-radius: 16px; font-weight: 800; }
.sheet-primary { border: 0; color: #171528; background: linear-gradient(135deg, #ffe98d, #e5ad2c); box-shadow: 0 12px 28px rgba(247,201,77,.15); }
.sheet-primary:disabled, .sheet-secondary:disabled { opacity: .55; cursor: wait; }
.sheet-secondary { margin-top: 9px; border: 1px solid var(--line); color: #eceef8; background: rgba(255,255,255,.055); }

.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 36px); padding: 11px 15px; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; color: #f5f6ff; font-size: 12px; text-align: center; background: rgba(29,32,56,.96); box-shadow: 0 16px 45px rgba(0,0,0,.35); transform: translateX(-50%); animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (max-width: 370px) {
  .mobile-frame { padding-left: 14px; padding-right: 14px; }
  .subscription-card { padding: 18px; }
  .card-head h2 { font-size: 23px; }
  .subscription-meta { gap: 24px; }
  .plan-card { min-height: 119px; padding: 14px; }
  .plan-card strong { font-size: 21px; }
}
@media (min-width: 700px) {
  .app-shell { padding: 24px 0; }
  .mobile-frame { padding-top: 32px; border: 1px solid rgba(255,255,255,.055); border-radius: 34px; background: rgba(8,10,24,.42); box-shadow: 0 40px 100px rgba(0,0,0,.25); }
  .payment-sheet { margin-bottom: 24px; border: 1px solid rgba(255,255,255,.11); border-radius: 29px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
