:root {
  --bg: var(--tg-theme-bg-color, #f5f7fa);
  --text: var(--tg-theme-text-color, #002742);
  --hint: var(--tg-theme-hint-color, #6b8cad);
  --btn: var(--tg-theme-button-color, #007cff);
  --btn-text: var(--tg-theme-button-text-color, #fff);
  --secondary: var(--tg-theme-secondary-bg-color, #fff);
}

* { box-sizing: border-box; }

.tg-toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 9999;
  max-width: min(92vw, 360px);
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(0, 39, 66, 0.92);
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.tg-toast.hidden { display: none; }

.menu-item.is-busy {
  opacity: 0.55;
  pointer-events: none;
}
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", sans-serif;
}
.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 16px;
}
.logo { height: 24px; width: auto; }
.user { font-size: 13px; color: var(--hint); }

.hero-card {
  background: linear-gradient(135deg, #027bff 0%, #606efd 50%, #9867fd 100%);
  border-radius: 16px;
  padding: 22px 20px;
  color: #fff;
  box-shadow: 0 12px 32px rgba(2, 123, 255, 0.25);
}
.hero-stats {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.hero-stat {
  flex: 1;
  min-width: 0;
}
.hero-stat-right {
  text-align: right;
}
.hero-label { margin: 0; font-size: 13px; opacity: 0.9; }
.hero-amount {
  margin: 8px 0 0;
  font-size: clamp(26px, 8vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.hero-sub { margin: 14px 0 0; font-size: 14px; opacity: 0.85; }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.action {
  border: none;
  border-radius: 12px;
  padding: 11px 10px;
  min-height: 0;
  text-align: left;
  background: var(--secondary);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0, 39, 66, 0.06);
}
.action-with-icon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-right: 8px;
}
.action-body {
  flex: 1;
  min-width: 0;
}
.action-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.action-icon svg {
  width: 28px;
  height: 28px;
}
.action.primary {
  background: var(--btn);
  color: var(--btn-text);
}
.action.primary .action-icon {
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
}
.action:not(.primary) .action-icon {
  color: #007cff;
  background: rgba(0, 124, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(0, 124, 255, 0.14);
}
.action-title { display: block; font-size: 14px; font-weight: 700; margin-bottom: 2px; line-height: 1.25; }
.action-desc { display: block; font-size: 11px; opacity: 0.75; line-height: 1.3; }

.menu-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 12px;
  padding: 10px 4px;
  min-height: 64px;
  font-size: 11px;
  background: var(--secondary);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 39, 66, 0.05);
  cursor: pointer;
}
.menu-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #007cff;
}
.menu-item-icon svg {
  width: 24px;
  height: 24px;
}
.menu-item-label {
  line-height: 1.2;
  font-weight: 500;
  white-space: nowrap;
}
.menu-item-share .menu-item-icon {
  color: #007cff;
}

.promo-video {
  position: relative;
  margin-top: 18px;
  width: 100%;
  height: 196px;
  border-radius: 15px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 20px 51px -32px rgba(39, 60, 86, 0.85);
}
.promo-video-el {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sqb-hero-cta {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  backdrop-filter: blur(4px);
  font-family: inherit;
}

.hidden { display: none !important; }

.view-detail {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 8px 16px calc(28px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #eef4fc 0%, var(--bg) 220px);
}
.detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0 12px;
}
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: #007cff;
  font-size: 15px;
  font-weight: 600;
  padding: 8px 12px 8px 8px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 39, 66, 0.06);
  font-family: inherit;
}
.detail-hero {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  min-height: 168px;
  box-shadow: 0 16px 40px rgba(2, 123, 255, 0.18);
  margin-bottom: 20px;
}
.detail-hero-img {
  width: 100%;
  height: 168px;
  object-fit: cover;
  display: block;
}
.detail-hero-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 39, 66, 0.72) 0%, rgba(0, 39, 66, 0.15) 70%);
}
.detail-hero-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 18px;
  color: #fff;
}
.detail-kicker {
  margin: 0 0 4px;
  font-size: 12px;
  opacity: 0.9;
  letter-spacing: 0.04em;
}
.detail-title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.detail-lead {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.45;
  opacity: 0.92;
  max-width: 92%;
}
.detail-section {
  margin-bottom: 22px;
}
.detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.detail-section-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #002742;
}
.detail-chevron {
  color: #007cff;
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.detail-card {
  border: none;
  text-align: left;
  background: #fff;
  border-radius: 14px;
  padding: 12px 12px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 39, 66, 0.06);
  font-family: inherit;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 68px;
}
.detail-card:active {
  transform: scale(0.98);
}
.detail-card-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  margin: 0;
}
.detail-card-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #002742;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}
.detail-card-span2 {
  grid-column: span 2;
  padding: 14px 16px;
  gap: 14px;
}
.detail-card-span2 .detail-card-icon {
  width: 44px;
  height: 44px;
}
.detail-terminals {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.detail-terminal {
  border: none;
  background: #fff;
  border-radius: 14px;
  padding: 12px 10px 14px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 39, 66, 0.06);
  font-family: inherit;
  text-align: center;
}
.detail-terminal img {
  width: 100%;
  max-height: 88px;
  object-fit: contain;
  display: block;
  margin: 0 auto 8px;
}
.detail-terminal span {
  font-size: 13px;
  font-weight: 600;
  color: #002742;
}
.detail-cta-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.detail-cta {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #027bff, #606efd);
  color: #fff;
  box-shadow: 0 8px 24px rgba(2, 123, 255, 0.28);
  font-family: inherit;
}
.detail-cta-muted {
  background: #fff;
  color: #007cff;
  box-shadow: 0 2px 12px rgba(0, 39, 66, 0.08);
  border: 1px solid rgba(0, 124, 255, 0.2);
}
.detail-sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.detail-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 20, 40, 0.45);
}
.detail-sheet-panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 28px 20px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
  animation: sheetUp 0.28s ease;
}
@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.detail-sheet-close {
  position: absolute;
  right: 16px;
  top: 12px;
  border: none;
  background: #f0f4f8;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #5a7184;
}
.detail-sheet-icon {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin: 0 auto 12px;
}
.detail-sheet-name {
  margin: 0 0 10px;
  font-size: 20px;
  color: #002742;
}
.detail-sheet-desc {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.55;
  color: #3f5468;
  text-align: left;
}