/* In-app top-up sheet (public/topup-sheet.mjs). The catalog renders either with the Telegram Mini App
   skin (html.tg-app — real Telegram and /online) or as the bare dark iPhone-Safari catalog (app-context
   only). The marketing stylesheets (site.css, mini.css) force `.modal-card` white with !important, so
   the sheet uses its OWN card class and a hardcoded dark base instead of ambient tokens, and layers the
   Telegram palette on top under html.tg-app. It reuses only the theme-neutral .modal / .modal-backdrop
   overlay for positioning. */

.topup-sheet .modal-backdrop { background: rgba(0, 0, 0, .6); }
.topup-card {
  position: relative; width: 100%; max-width: 480px; max-height: calc(100dvh - 48px);
  overflow-y: auto; overscroll-behavior: contain; text-align: left;
  padding: 32px 24px 24px; border: 1px solid #272b30; border-radius: 24px;
  background: #16191d; color: #f4f5f7; box-shadow: 0 20px 100px #0009;
}
@media (max-width: 640px) {
  .topup-sheet.modal { align-items: flex-end; padding: 0; }
  .topup-card { border-radius: 24px 24px 0 0; max-height: 92dvh; padding: 28px 20px max(24px, env(safe-area-inset-bottom)); border-bottom: 0; }
}
.topup-card .modal-close { position: absolute; right: 12px; top: 12px; width: 44px; height: 44px; padding: 0; background: none; border: 0; color: #aab1bb; font-size: 28px; line-height: 1; }

.topup-title { margin: 2px 0 8px; font-size: 26px; line-height: 1.15; letter-spacing: -.6px; font-weight: 700; color: #f4f5f7; }
.topup-intro { margin: 0 0 18px; font-size: 14px; line-height: 1.5; color: #a0a6af; }
.topup-loading, .topup-empty { margin: 8px 0 14px; font-size: 15px; color: #a0a6af; }

.topup-group { margin: 18px 0 10px; font-size: 13px; font-weight: 600; color: #a0a6af; }
.topup-group:first-child { margin-top: 2px; }

.topup-packs { display: grid; gap: 10px; }
.topup-method { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0 0 14px; padding: 4px; border-radius: 14px; background: #131518; border: 1px solid #272b30; }
.topup-method-option { min-height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: none; color: #a0a6af; font-size: 14px; font-weight: 600; }
.topup-method-option.is-active { background: #272b30; color: #f4f5f7; }
.topup-pack {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 64px; padding: 14px 16px; text-align: left;
  border: 1px solid #272b30; border-radius: 16px; background: #131518; color: #f4f5f7;
}
.topup-pack:hover { border-color: #3c434d; background: #1b1e22; }
.topup-pack.is-highlight { border-color: #77e5a2; box-shadow: 0 0 0 1px #77e5a2 inset; }
.topup-pack:disabled { opacity: .55; cursor: wait; }
.topup-pack-copy { display: grid; gap: 3px; min-width: 0; }
.topup-pack-copy strong { font-size: 16px; font-weight: 650; color: #f4f5f7; }
.topup-pack-copy span { font-size: 13px; color: #a0a6af; }
.topup-pack-right { display: flex; align-items: center; gap: 10px; flex: none; }
.topup-pack-price { font-size: 16px; font-weight: 700; white-space: nowrap; color: #f4f5f7; }
.topup-pack-badge {
  display: inline-grid; place-items: center; padding: 3px 8px; border-radius: 999px;
  background: linear-gradient(140deg, #ff5fa8, #d0106f); color: #fff; font-size: 12px; font-weight: 800;
}

.topup-promo { margin: 16px 0 6px; border-top: 1px solid #272b30; padding-top: 12px; }
.topup-promo > summary { cursor: pointer; list-style: none; font-size: 14px; color: #a0a6af; min-height: 32px; display: flex; align-items: center; }
.topup-promo > summary::-webkit-details-marker { display: none; }
.topup-promo-row { display: flex; gap: 8px; margin-top: 10px; }
.topup-promo-input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid #363b43; background: #1b1e22; color: #f4f5f7; font-size: 15px; outline: none;
}
.topup-promo-input:focus { border-color: #77e5a2; }
.topup-promo-apply { flex: none; min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px; background: #1b1e22; color: #b9f6ce; font-size: 14px; font-weight: 600; }
.topup-promo-note { margin: 8px 0 0; font-size: 13px; color: #a0a6af; min-height: 1em; }
.topup-promo-note.is-ok { color: #b9f6ce; }
.topup-promo-note.is-error { color: #f2a08a; }

.topup-link { display: inline-block; margin-top: 16px; font-size: 15px; color: #b9f6ce; text-decoration: none; }
.topup-link.is-primary { padding: 12px 18px; border-radius: 12px; background: #b9f6ce; color: #143322; font-weight: 650; }

.topup-status { margin: 14px 0 0; font-size: 14px; line-height: 1.5; color: #a0a6af; font-variant-numeric: tabular-nums; }
.topup-status:empty { margin: 0; }
.topup-status.is-error { color: #f2a08a; }

/* Telegram Mini App + /online skin: follow the Telegram palette (telegram.css tokens), light or dark. */
html.tg-app .topup-card { background: var(--tg-bg); color: var(--tg-text); border-color: var(--tg-sep); box-shadow: var(--v-shadow-lg, 0 20px 100px #0006); }
html.tg-app .topup-sheet .modal-backdrop { background: rgba(0, 0, 0, .4); }
html.tg-app .topup-card .modal-close { background: var(--tg-fill); color: var(--tg-hint); border-radius: 999px; width: 32px; height: 32px; font-size: 20px; }
html.tg-app .topup-title, html.tg-app .topup-pack-copy strong, html.tg-app .topup-pack-price { color: var(--tg-text); }
html.tg-app .topup-intro, html.tg-app .topup-loading, html.tg-app .topup-empty,
html.tg-app .topup-group, html.tg-app .topup-pack-copy span, html.tg-app .topup-promo > summary,
html.tg-app .topup-promo-note, html.tg-app .topup-status { color: var(--tg-hint); }
html.tg-app .topup-group, html.tg-app .topup-promo { border-color: var(--tg-sep); }
html.tg-app .topup-pack { background: var(--tg-card); color: var(--tg-text); border-color: var(--tg-sep); }
html.tg-app .topup-pack:hover { background: var(--tg-fill); border-color: var(--tg-sep); }
html.tg-app .topup-pack.is-highlight { border-color: var(--tg-accent); box-shadow: 0 0 0 1px var(--tg-accent) inset; }
html.tg-app .topup-promo-input { background: var(--tg-fill); border-color: var(--tg-sep); color: var(--tg-text); }
html.tg-app .topup-promo-input:focus { border-color: var(--tg-accent); }
html.tg-app .topup-promo-apply { background: var(--tg-fill); color: var(--tg-accent); }
html.tg-app .topup-promo-note.is-ok, html.tg-app .topup-link { color: var(--tg-accent); }
html.tg-app .topup-link.is-primary { background: var(--tg-accent); color: #fff; }
html.tg-app .topup-method { background: var(--tg-fill); border-color: var(--tg-sep); }
html.tg-app .topup-method-option { color: var(--tg-hint); }
html.tg-app .topup-method-option.is-active { background: var(--tg-card); color: var(--tg-text); }

/* Stars paid: the new balance, big (topup-sheet.mjs showPaid) */
.topup-paid { display: grid; gap: 2px; justify-items: center; margin: 10px 0 18px; text-align: center; }
.topup-paid-balance { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.topup-paid-note { font-size: 14px; color: #a0a6af; }
html.tg-app .topup-paid-balance { color: var(--tg-text); }
html.tg-app .topup-paid-note { color: var(--tg-hint); }
.topup-paid + .topup-link.is-primary { display: block; width: 100%; text-align: center; border: 0; font: inherit; font-weight: 650; cursor: pointer; }

/* Motion: slides up from the bottom like an iOS sheet; the backdrop fades. Transform/opacity only. */
.topup-sheet .modal-backdrop { opacity: 0; transition: opacity .28s ease; }
.topup-sheet.is-open .modal-backdrop { opacity: 1; }
.topup-sheet .topup-card { transform: translateY(24px); opacity: 0; transition: transform .34s cubic-bezier(.32, .72, 0, 1), opacity .2s ease; will-change: transform; }
.topup-sheet.is-open .topup-card { transform: none; opacity: 1; }
@media (max-width: 640px) {
  .topup-sheet .topup-card { transform: translateY(100%); opacity: 1; }
  .topup-sheet.is-open .topup-card { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .topup-sheet .modal-backdrop, .topup-sheet .topup-card { transition: none; }
}
/* Pack placeholders while loading (same box as .topup-pack). */
.topup-pack.is-skeleton { background: #1b1e22; border-color: transparent; animation: topup-skeleton 1.2s ease-in-out infinite; }
html.tg-app .topup-pack.is-skeleton { background: var(--tg-fill); border-color: transparent; }
@keyframes topup-skeleton { 50% { opacity: .55; } }
