html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--tg-theme-bg-color, #0b0f17);
  color: var(--tg-theme-text-color, #f4f7fb);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  padding: 14px;
}

button, input, textarea {
  font: inherit;
}

.app {
  max-width: 920px;
  margin: 0 auto;
  opacity: 1;
  transition: opacity .2s ease;
}

.app.loading {
  opacity: .7;
}

.hidden {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(106,134,255,.95), rgba(53,220,182,.95));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  overflow: hidden;
  flex: 0 0 auto;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}

.brand-subtitle {
  margin-top: 4px;
  color: var(--tg-theme-hint-color, rgba(255,255,255,.6));
  font-size: 13px;
}

.icon-button {
  border: 0;
  border-radius: 14px;
  min-width: 44px;
  min-height: 44px;
  background: rgba(255,255,255,.08);
  color: var(--tg-theme-text-color, #fff);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}

.content {
  display: grid;
  gap: 14px;
}

.card {
  background: rgba(20, 26, 37, .9);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,.22);
  backdrop-filter: blur(12px);
}

.hero-card {
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, .8fr);
  gap: 18px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(106,134,255,.18);
  color: #b8c6ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.hero-title {
  margin: 12px 0 10px;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1;
}

.hero-text {
  color: var(--tg-theme-hint-color, rgba(255,255,255,.72));
  font-size: 15px;
  line-height: 1.6;
}

.hero-text p {
  margin: 0 0 10px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.hero-image-wrap {
  width: 100%;
  min-height: 220px;
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab {
  white-space: nowrap;
  border: 0;
  border-radius: 999px;
  padding: 11px 15px;
  background: rgba(255,255,255,.07);
  color: var(--tg-theme-text-color, #fff);
  cursor: pointer;
}

.tab.active {
  background: linear-gradient(135deg, rgba(106,134,255,.95), rgba(53,220,182,.95));
  color: #081019;
  font-weight: 700;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.metric {
  font-size: 28px;
  line-height: 1.1;
  font-weight: 800;
}

.muted {
  color: var(--tg-theme-hint-color, rgba(255,255,255,.65));
  line-height: 1.55;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255,255,255,.08);
}

.badge.success {
  background: rgba(51, 198, 122, .16);
  color: #74efac;
}

.badge.warn {
  background: rgba(255, 182, 66, .16);
  color: #ffd28f;
}

.badge.danger {
  background: rgba(255, 91, 117, .16);
  color: #ff9aaa;
}

.button {
  border: 0;
  min-height: 46px;
  border-radius: 16px;
  padding: 0 16px;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}

.button:active {
  transform: scale(.98);
}

.button.primary {
  background: linear-gradient(135deg, rgba(106,134,255,.95), rgba(53,220,182,.95));
  color: #071018;
  font-weight: 800;
}

.button.secondary {
  background: rgba(255,255,255,.1);
  color: var(--tg-theme-text-color, #fff);
}

.button.ghost {
  background: transparent;
  color: var(--tg-theme-link-color, #7ab9ff);
  border: 1px solid rgba(255,255,255,.08);
}

.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rich-text {
  color: var(--tg-theme-text-color, #fff);
  line-height: 1.6;
}

.rich-text b {
  font-weight: 700;
}

.rich-text p {
  margin: 0 0 10px;
}

.item-list {
  display: grid;
  gap: 12px;
}

.item {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.05);
}

.item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.item-title {
  font-size: 16px;
  font-weight: 700;
}

.value {
  word-break: break-word;
  line-height: 1.5;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

.payment-box {
  margin-top: 16px;
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.05);
}

.payment-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.payment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(11, 16, 24, .96);
  color: #fff;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 12px 16px;
  max-width: calc(100vw - 28px);
  z-index: 50;
  box-shadow: 0 18px 36px rgba(0,0,0,.32);
}

.blocked {
  margin-top: 60px;
}

@media (max-width: 760px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .metric {
    font-size: 24px;
  }

  .hero-title {
    font-size: 32px;
  }
}
