:root {
  --page: var(--tg-theme-secondary-bg-color, #232e3c);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #17212b));
  --text: var(--tg-theme-text-color, #f5f5f5);
  --hint: var(--tg-theme-hint-color, #708499);
  --link: var(--tg-theme-link-color, #6ab3f3);
  --accent: var(--tg-theme-button-color, #5288c1);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive-text-color, #ec3942);
  --radio: color-mix(in srgb, var(--hint) 22%, transparent);
  --line: color-mix(in srgb, var(--hint) 18%, transparent);
  --green: #35b335;
  --gold: #f5b400;
  --grad: linear-gradient(90deg, #625ff1 0%, #9b5bd0 52%, #dc5888 100%);
  --r: 12px;
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { background: var(--page); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font: 400 16px/1.4 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 24px; height: 24px; flex: none; }

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 16px calc(24px + var(--safe-b));
}

h1 { font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -.2px; margin: 4px 0 6px; }
h2 { font-size: 21px; font-weight: 700; margin: 18px 0 6px; }
.sub { margin: 0 0 4px; font-size: 15px; font-weight: 500; opacity: .92; line-height: 1.35; }
.hint { color: var(--hint); }
.small { font-size: 14px; }
.center { text-align: center; }
.balance-line { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 16px; font-size: 15px; min-height: 26px; }
.mini-link { padding: 3px 10px; border: 0; border-radius: 8px; background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--link); font-size: 14px; font-weight: 600; }
.balance-line b, #t-bal { color: var(--text); font-weight: 600; }

/* ---------- tariflar ---------- */
.plans { display: grid; gap: 10px; }
.plan {
  display: flex; align-items: center; gap: 12px;
  width: 100%; height: 54px; padding: 0 16px;
  background: var(--card); color: var(--text);
  border: 2px solid transparent; border-radius: var(--r);
  text-align: left;
  transition: border-color .15s ease, transform .12s ease;
}
.plan:active { transform: scale(.985); }
.plan.sel { border-color: var(--accent); }
.radio {
  position: relative; width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: var(--radio);
  transition: background .15s ease;
}
.plan.sel .radio { background: var(--accent); }
.plan.sel .radio::after {
  content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--accent-text);
}
.plan-t { flex: 1; font-size: 16px; font-weight: 500; }
.plan-p { display: inline-flex; align-items: center; gap: 6px; color: var(--hint); font-size: 16px; font-variant-numeric: tabular-nums; }
.plan-p svg { width: 21px; height: 21px; }
.star-img { width: 22px; height: 22px; display: block; }
.plan.sel .plan-p { color: var(--text); }

.link {
  display: inline-block; margin: 14px 0 12px; padding: 4px 0;
  background: none; border: 0; color: var(--link); font-size: 15px;
}
.label { margin-bottom: 10px; font-size: 16px; font-weight: 500; }

/* ---------- to'lov turi ---------- */
.methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.method {
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  min-height: 108px; padding: 12px;
  background: var(--card); color: var(--text);
  border: 2px solid transparent; border-radius: var(--r);
  text-align: left; font-size: 16px; font-weight: 500; line-height: 1.25;
  transition: border-color .15s ease;
}
.method.active { border-color: var(--accent); }
.ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; }
.ico svg { width: 24px; height: 24px; }
.ico-card { background: #5a8fd0; color: #fff; }
.ico-star { background: color-mix(in srgb, var(--gold) 22%, transparent); }
.ico-star img { width: 30px; height: 30px; display: block; filter: drop-shadow(0 2px 4px rgba(245, 140, 0, .35)); }

/* ---------- tugmalar ---------- */
.btn-outline {
  display: block; width: 100%; height: 54px; margin-top: 16px;
  background: var(--card); color: var(--text);
  border: 2px solid var(--green); border-radius: var(--r);
  font-size: 17px; font-weight: 700;
}
.btn-grad {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 52px; margin-top: 34px;
  background: var(--grad); color: #fff;
  border: 0; border-radius: 10px;
  font-size: 18px; font-weight: 600; text-decoration: none;
  cursor: pointer; transition: opacity .15s ease, transform .12s ease;
}
.btn-grad svg { width: 26px; height: 26px; }
.btn-grad:active, .btn-outline:active, .method:active { transform: scale(.985); }
/* «Hisobni to'ldirish»: ranglari qimirlab turadi + yaltiroq chiziq o'tadi */
.btn-grad.live {
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(90deg, #625ff1 0%, #9b5bd0 25%, #dc5888 50%, #f08a5d 62%, #9b5bd0 80%, #625ff1 100%);
  background-size: 220% 100%;
  animation: grad-move 3.2s ease-in-out infinite alternate, glow 3.2s ease-in-out infinite alternate;
}
.btn-grad.live::after {
  content: ""; position: absolute; z-index: -1; top: 0; bottom: 0; left: -45%; width: 35%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .38), transparent);
  transform: skewX(-20deg);
  animation: shine 2.6s ease-in-out infinite;
}
@keyframes grad-move { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
@keyframes glow {
  from { box-shadow: 0 6px 20px -10px rgba(98, 95, 241, .7); }
  to { box-shadow: 0 8px 26px -8px rgba(220, 88, 136, .75); }
}
@keyframes shine { 0% { left: -45%; } 60%, 100% { left: 125%; } }
.btn-grad:disabled, .btn-grad.busy { opacity: .5; pointer-events: none; }
.btn-text {
  display: block; width: 100%; margin-top: 10px; padding: 14px;
  background: none; border: 0; color: var(--link); font-size: 16px; font-weight: 500;
}
.btn-text.danger { color: var(--danger); }

/* ---------- faol obuna banneri ---------- */
.banner {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 14px; padding: 12px 12px 12px 14px;
  background: color-mix(in srgb, var(--green) 14%, var(--card));
  border: 1px solid color-mix(in srgb, var(--green) 40%, transparent);
  border-radius: var(--r);
}
.banner-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: #fff; flex: none; }
.banner-ico svg { width: 20px; height: 20px; }
.banner-txt { flex: 1; display: flex; flex-direction: column; font-size: 15px; line-height: 1.3; }
.banner-txt span { color: var(--hint); font-size: 14px; }
.banner-btn { padding: 8px 12px; border: 0; border-radius: 9px; background: var(--green); color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; }

/* ---------- to'ldirish ---------- */
.t-form {
  display: flex; flex-direction: column;
  min-height: calc(var(--tg-viewport-stable-height, 100vh) - 14px - 24px - var(--safe-b));
}
.t-form .balance-line { margin-bottom: 14px; }
.label-sm { display: block; margin: 0 0 8px 2px; color: var(--hint); font-size: 15px; }
.field {
  display: flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 16px;
  background: var(--card); border: 2px solid transparent; border-radius: var(--r);
  transition: border-color .15s ease;
}
.field:focus-within { border-color: var(--accent); }
.field.bad { border-color: var(--danger); }
.field input {
  flex: 1; min-width: 0; height: 100%;
  background: none; border: 0; outline: 0;
  font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.field input::placeholder { color: var(--hint); font-weight: 400; font-size: 17px; }
.suffix { color: var(--hint); font-size: 16px; }
.field-err { margin: 8px 2px 0; color: var(--danger); font-size: 14px; }

.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.chip {
  height: 40px; padding: 0 6px;
  background: transparent; color: var(--text);
  border: 1.5px solid color-mix(in srgb, var(--accent) 85%, transparent); border-radius: 10px;
  font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums;
  transition: background .15s ease, color .15s ease, transform .12s ease;
}
.chip:active { transform: scale(.97); }
.chip.sel { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.summary { margin-top: 14px; padding: 12px 16px; background: var(--card); border-radius: var(--r); animation: fade .2s ease; }
.sum-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 15px; }
.sum-row > span:first-child { color: var(--hint); }
.sum-row b, .sum-row span:last-child { font-variant-numeric: tabular-nums; }
.sum-row.total { font-size: 17px; }
.sum-row.total > span:first-child { color: var(--text); font-weight: 500; }
.sum-row.total b { font-size: 19px; }
.divider { height: 1px; margin: 10px 0; background: var(--line); }

.note {
  display: flex; align-items: flex-start; gap: 12px;
  margin-top: 14px; padding: 10px 14px;
  background: color-mix(in srgb, var(--card) 70%, transparent); border-radius: var(--r);
}
.note-ico { color: var(--link); padding-top: 1px; }
.note-ico svg { width: 22px; height: 22px; }
.note p { margin: 0; font-size: 14px; line-height: 1.45; color: color-mix(in srgb, var(--text) 85%, transparent); }

.pay-panel {
  margin: auto -16px calc(-24px - var(--safe-b));
  padding: 16px 16px calc(12px + var(--safe-b));
  background: var(--card); border-radius: 18px 18px 0 0;
  position: relative; top: 0;
}
.t-form .note { margin-bottom: 18px; }
.pay-title { margin: 0 2px 12px; color: var(--hint); font-size: 18px; font-weight: 700; }
.provider {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; height: 66px; padding: 0 16px 0 18px;
  background: var(--page); color: var(--text);
  border: 2px solid var(--accent); border-radius: 14px;
  transition: opacity .15s ease, transform .12s ease, border-color .15s ease;
}
.provider:active { transform: scale(.985); }
.provider:disabled { opacity: .55; border-color: transparent; cursor: default; transform: none; }
.provider.busy { opacity: .6; pointer-events: none; }
.click-logo { height: 28px; width: auto; display: block; }
.prov-right { display: inline-flex; align-items: center; gap: 4px; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.provider:disabled .prov-right { color: var(--hint); font-weight: 500; font-size: 15px; }
.prov-right svg { width: 20px; height: 20px; color: var(--hint); }
.prov-sub { margin: 8px 0 0; }
.pay-panel .btn-text { margin-top: 2px; padding: 12px; font-size: 15px; }

.wait-card { width: 100%; margin-top: 22px; padding: 12px 16px; background: var(--card); border-radius: var(--r); text-align: left; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .5px; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.07); opacity: .8; } }
.plus { margin: 6px 0 2px; font-size: 30px; font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; }
#t-wait .btn-grad { margin-top: 22px; }
#t-wait .btn-text { margin-top: 4px; }

/* asosiy ekrandagi «to'lov kutilmoqda» banneri */
.banner.pay {
  width: 100%; text-align: left; color: var(--text);
  background: color-mix(in srgb, var(--accent) 14%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.banner.pay .banner-ico { background: var(--accent); }
.banner-go { color: var(--hint); }
.banner-go svg { width: 20px; height: 20px; }

/* ---------- holat ekranlari ---------- */
.state { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 44px; }
.state .hint { max-width: 340px; margin: 4px 0 0; }
.state .btn-outline, .state .btn-grad { margin-top: 28px; }
.state-ico { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; }
.state-ico svg { width: 44px; height: 44px; }
.state-ico.ok { background: var(--green); color: #fff; animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }
.state-ico.wait { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--link); }
.state-ico.lock { background: var(--card); color: var(--hint); }
.ch-list { display: grid; gap: 10px; width: 100%; margin-top: 24px; }
.ch-list .btn-grad { margin: 0; }
.ch-list .btn-outline { margin: 0; }
#d-note { margin-top: 14px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- bottom sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); animation: fade .2s ease; }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 560px; max-height: 82vh; margin: 0 auto; overflow-y: auto;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  background: var(--card); border-radius: 18px 18px 0 0;
  animation: up .26s cubic-bezier(.2, .9, .3, 1);
}
.sheet-grip { width: 38px; height: 5px; margin: 0 auto 6px; border-radius: 3px; background: var(--line); }
.sheet-content { color: var(--hint); font-size: 15.5px; line-height: 1.5; }
.sheet-content b { color: var(--text); }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 30;
  max-width: calc(100% - 32px); padding: 12px 16px;
  background: rgba(20, 24, 30, .94); color: #fff; border-radius: 12px;
  font-size: 15px; text-align: center;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- skeleton ---------- */
.sk { position: relative; overflow: hidden; }
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--hint) 12%, transparent), transparent);
  animation: shimmer 1.2s infinite;
}
.sk-line { display: inline-block; width: 180px; height: 16px; border-radius: 6px; background: var(--card); vertical-align: middle; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 360px) {
  .method { font-size: 15px; min-height: 100px; }
  .plan { height: 50px; }
}

/* ---------- pastki asosiy tugma (bosh barmoq zonasi) ---------- */
#v-main { padding-bottom: calc(76px + var(--safe-b)); }
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  padding: 20px 16px calc(12px + var(--safe-b));
  background: linear-gradient(to top, var(--page) 65%, color-mix(in srgb, var(--page) 0%, transparent));
  pointer-events: none;
}
.action-inner { max-width: 528px; margin: 0 auto; pointer-events: auto; }
.act {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; min-height: 54px; height: auto; margin: 0; padding: 6px 14px;
  border: 0; border-radius: 14px;
  font-size: 17px; font-weight: 600; line-height: 1.15;
  transition: opacity .15s ease, transform .12s ease;
}
.act:active { transform: scale(.985); }
.act.btn-grad { margin-top: 0; }
.act-primary { background: var(--accent); color: var(--accent-text); }
.act:disabled { opacity: .45; cursor: default; transform: none; }
.act.busy { opacity: .6; pointer-events: none; }
.act-main { display: inline-flex; align-items: center; gap: 8px; }
.act-main svg { width: 22px; height: 22px; }
.act-main .star-img { width: 22px; height: 22px; }
.act-sub { margin-top: 2px; font-size: 13px; font-weight: 500; opacity: .92; }
