/* ─── Bottom sheet (iOS-26 floating, ref: Telegram Sheet) ─────────────────── */

.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  animation: sheet-fade 0.2s ease;
}
.sheet-scrim[hidden] { display: none; }
.sheet-scrim--blurred {
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.sheet {
  position: relative;
  width: calc(100% - 16px);
  max-width: 460px;
  margin-bottom: max(calc(var(--safe-bottom) - 5px), 8px);
  max-height: 82dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 30px;
  box-shadow: 0 15px 75px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  animation: sheet-up 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes sheet-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(110%); } to { transform: translateY(0); } }

.sheet__grab {
  flex: none;
  width: 36px;
  height: 5px;
  border-radius: 3px;
  margin: 8px auto 0;
  background: color-mix(in srgb, var(--text) 18%, transparent);
}
.sheet__close {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: var(--hint);
  transition: transform 0.08s, background 0.15s;
}
.sheet__close:active { transform: scale(0.92); }
.sheet__close svg { width: 14px; height: 14px; }
.sheet__back {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  margin-left: -8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--accent);
  transition: transform 0.08s, background 0.15s;
}
.sheet__back:active { transform: scale(0.92); }
.sheet__back svg { width: 22px; height: 22px; }
.sheet__action {
  min-width: 68px;
  min-height: 40px;
  flex: none;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  line-height: 18px;
  font-weight: 600;
  transition: transform 0.08s, background 0.15s, opacity 0.15s;
}
.sheet__action:active { transform: scale(0.96); filter: brightness(0.92); }
.sheet__action:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sheet__action:disabled { opacity: 0.45; cursor: default; }
.sheet__header {
  position: relative;
  flex: none;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 12px 8px 20px;
}
.sheet__header--nested { padding-left: 12px; }
.sheet__header--nested .sheet__header-title {
  position: absolute;
  left: 50%;
  width: min(48%, 220px);
  transform: translateX(-50%);
  color: var(--text);
  font-size: 17px;
  line-height: 22px;
  font-weight: 590;
  text-align: center;
}
.sheet__header--nested .sheet__action,
.sheet__header--nested .sheet__close { margin-left: auto; }
.sheet__header--visual {
  flex-direction: column;
  padding-top: 8px;
}
.sheet__header--visual .sheet__close,
.sheet__header--centered .sheet__close {
  position: absolute;
  top: 2px;
  right: 12px;
}
.sheet__header--centered { padding-inline: 20px; }
.sheet__header--centered .sheet__header-title {
  flex: none;
  width: 100%;
  padding-inline: 36px;
  text-align: center;
}
.sheet__header-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px 20px 28px;
}
.sheet__subtitle { margin: 0 0 14px; color: var(--hint); font-size: 0.9rem; line-height: 1.4; }
.sheet__subtitle--centered { text-align: center; }
.tg-alert-scrim[hidden] { display: none; }
.tg-alert-scrim {
  position: fixed; inset: 0; z-index: 240; display: grid; place-items: center;
  padding: 20px; background: rgba(0, 0, 0, 0.4);
}
.tg-alert {
  width: min(300px, 100%); padding: 14px; border-radius: 34px;
  background: color-mix(in srgb, var(--section-bg) 96%, transparent);
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(30px) saturate(150%); -webkit-backdrop-filter: blur(30px) saturate(150%);
  text-align: center;
}
.tg-alert h2 { margin: 6px 8px 4px; color: var(--text); font-size: 17px; line-height: 22px; font-weight: 700; }
.tg-alert p { margin: 0 8px 14px; color: var(--hint); font-size: 13px; line-height: 18px; }
.tg-alert__actions { display: grid; gap: 8px; }
.tg-alert__button {
  min-height: 44px; padding: 13px 16px; border: 0; border-radius: 100px;
  background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text);
  font-size: 14px; line-height: 18px; font-weight: 600;
}
.tg-alert__button--primary { background: #008bff; color: #fff; }
.tg-alert__button--destructive { color: var(--destructive); }
.tg-alert__button:focus-visible { outline: 2px solid #008bff; outline-offset: 2px; }

/* Telegram iOS `Sheet - Full Screen` (6211:5047): the same modal/focus shell as
   BottomSheet, expanded to the viewport. */
.sheet-scrim--full { background: rgba(0, 0, 0, 0.32); }
.sheet--full {
  width: 100%;
  max-width: none;
  height: calc(100dvh - var(--safe-top) - var(--content-top) - 8px);
  max-height: none;
  min-height: 60dvh;
  margin-bottom: 0;
  border-radius: 38px 38px 0 0;
}
.sheet__body--full { min-height: 0; display: flex; overflow: hidden; padding: 0; }

.template-preview__trigger { margin-top: 20px; }
.template-preview__stage {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: #fff;
}
.template-preview__frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.template-preview__placeholder {
  width: 100%;
  height: 100%;
  min-height: 240px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  color: #8e8e93;
  font-size: 14px;
  text-align: center;
}

.sheet__avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 10px;
  display: block;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}
.sheet__avatar--fallback {
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 700;
  background: var(--accent);
  color: var(--accent-text);
}

/* ─── Wallet-connect centering (TonConnectButton) ─────────────────────────── */
.tc-center { display: flex; justify-content: center; padding: 6px 0; }
