/* =============================================
   ImaginingAI — Telegram Mini-App Styles
   Dark theme, mobile-first, Telegram CSS vars
   ============================================= */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Telegram theme variable fallbacks (dark) */
  --tg-theme-bg-color: #000000;
  --tg-theme-text-color: #ffffff;
  --tg-theme-hint-color: #8e8e93;
  --tg-theme-link-color: #a970ff;
  --tg-theme-button-color: #a970ff;
  --tg-theme-button-text-color: #ffffff;
  --tg-theme-secondary-bg-color: #1c1c1e;
  --tg-theme-section-bg-color: #1c1c1e;

  /* App design tokens — derived from Telegram vars for auto-theming */
  --accent: var(--tg-theme-button-color, #a970ff);
  --accent-glow: rgba(169, 112, 255, 0.35);
  --surface: var(--tg-theme-secondary-bg-color, #1c1c1e);
  --surface-hover: var(--tg-theme-section-bg-color, #2c2c2e);
  --text-primary: var(--tg-theme-text-color, #ffffff);
  --text-secondary: var(--tg-theme-hint-color, #8e8e93);
  --bg: var(--tg-theme-bg-color, #000000);
  --card-radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --tab-bar-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tg-safe-top: var(--tg-safe-area-inset-top, 0px);
  --tg-safe-bottom: var(--tg-safe-area-inset-bottom, 0px);
  --tg-safe-left: var(--tg-safe-area-inset-left, 0px);
  --tg-safe-right: var(--tg-safe-area-inset-right, 0px);
  --tg-content-top: var(--tg-content-safe-area-inset-top, 0px);
  --tg-content-bottom: var(--tg-content-safe-area-inset-bottom, 0px);
  --tg-content-left: var(--tg-content-safe-area-inset-left, 0px);
  --tg-content-right: var(--tg-content-safe-area-inset-right, 0px);

  /* Derived opacities that adapt to light/dark via theme vars */
  --overlay-light: rgba(255,255,255,.12);
  --overlay-dark: rgba(0,0,0,.55);
  --border-subtle: rgba(128,128,128,.15);
  --card-shadow: 0 1px 6px rgba(0,0,0,.6);
  --skeleton-mid: #2a2a2e;
}

/* Light-mode overrides when Telegram injects a light background.
   The SDK sets colorScheme; JS applies data-tg-color-scheme + body.tg-light. */
html[data-tg-color-scheme="light"],
html[style*="light"],
body.tg-light {
  --overlay-light: rgba(0,0,0,.06);
  --overlay-dark: rgba(255,255,255,.7);
  --border-subtle: rgba(0,0,0,.1);
  --card-shadow: 0 1px 4px rgba(0,0,0,.12);
  --skeleton-mid: #e8e8ec;
  --accent-glow: rgba(169, 112, 255, 0.2);
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font: inherit; }

/* --- Views --- */
.view {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: calc(var(--tab-bar-h) + max(var(--safe-bottom), var(--tg-safe-bottom)) + 8px);
}
.view.active { display: flex; }

/* Hide tab bar on certain views */
body.hide-tabs #tab-bar { display: none; }
body.hide-tabs .view { padding-bottom: 0; }

/* =============================================
   CATALOG VIEW
   ============================================= */

/* --- Hero Carousel --- */
.hero-carousel {
  padding: calc(var(--tg-content-top) + 8px) 0 0;
}
.hero-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  padding: 12px 20px 16px;
}
.carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 10px;
  padding: 0 16px;
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }

.carousel-card {
  flex: 0 0 75vw;
  max-width: 340px;
  aspect-ratio: 3 / 4;
  border-radius: var(--card-radius);
  overflow: hidden;
  position: relative;
  scroll-snap-align: center;
  background: var(--surface);
}
.carousel-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.carousel-card .card-label {
  position: absolute;
  bottom: 14px;
  left: 14px;
  font-weight: 700;
  font-size: 15px;
  text-shadow: 0 1px 6px rgba(0,0,0,.6);
}
.carousel-card .btn-try {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: opacity .2s;
}
.carousel-card.focus .btn-try { opacity: 1; }

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 12px 0 4px;
}
.carousel-dots .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--border-subtle);
  transition: background .2s;
}
.carousel-dots .dot.active { background: var(--text-primary); }

/* --- PRO Banner --- */
.pro-banner {
  margin: 12px 16px;
  padding: 14px 16px;
  border-radius: var(--card-radius);
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: transform .15s;
}
.pro-banner:active { transform: scale(.97); }
.pro-banner-text { display: flex; flex-direction: column; gap: 2px; }
.pro-banner-headline { font-weight: 700; font-size: 15px; }
.pro-banner-cta { font-size: 13px; opacity: .85; }
.pro-banner-thumbs { display: flex; gap: 4px; }
.pro-thumb {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: rgba(255,255,255,.15);
}

/* --- Category Sections --- */
.category-section {
  padding: 18px 0 0;
}
.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px 10px;
}
.category-title {
  font-size: 18px;
  font-weight: 700;
}
.btn-see-all {
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
}
.category-row {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 10px;
  padding: 0 16px 4px;
  scrollbar-width: none;
}
.category-row::-webkit-scrollbar { display: none; }

.style-card {
  flex: 0 0 42vw;
  max-width: 180px;
  aspect-ratio: 3 / 4;
  border-radius: var(--card-radius);
  overflow: hidden;
  position: relative;
  scroll-snap-align: start;
  background: var(--surface);
  cursor: pointer;
  transition: transform .15s;
}
.style-card:active { transform: scale(.96); }
.style-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.style-card .card-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  font-weight: 700;
  font-size: 13px;
  text-shadow: 0 1px 6px rgba(0,0,0,.6);
}
.style-card .pro-lock {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(6px);
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #ffd700;
}

/* =============================================
   STYLE DETAIL VIEW
   ============================================= */
.style-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
}
.btn-back {
  font-size: 18px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.header-brand {
  font-size: 16px;
  font-weight: 700;
}

.style-detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 20px;
}
.style-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.style-name {
  font-size: 28px;
  font-weight: 800;
}
.btn-share {
  padding: 8px;
  border-radius: 50%;
  background: var(--surface);
}
.style-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

/* Before / After */
.preview-pair {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.preview-card {
  flex: 1;
  aspect-ratio: 3 / 4;
  border-radius: var(--card-radius);
  overflow: hidden;
  position: relative;
  background: var(--surface);
}
.preview-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.preview-label {
  position: absolute;
  bottom: 10px;
  left: 12px;
  font-weight: 700;
  font-size: 14px;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}

.preview-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 8px 0 16px;
}
.preview-dots .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--border-subtle);
}
.preview-dots .dot.active { background: var(--text-primary); }

/* Upload Section */
.upload-section { margin-top: 8px; }
.section-label {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}

.photo-slots {
  display: flex;
  gap: 10px;
}
.photo-slot {
  flex: 1;
  aspect-ratio: 1;
  border-radius: var(--card-radius);
  overflow: hidden;
  position: relative;
  background: var(--surface);
}
.photo-slot.empty {
  border: 2px dashed var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-slot .file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.slot-placeholder {
  color: var(--text-secondary);
  opacity: .5;
}
.photo-slot .thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-slot .btn-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  z-index: 3;
  color: #fff;
}

/* CTA */
.btn-create-look {
  margin: 12px 16px calc(max(var(--safe-bottom), var(--tg-safe-bottom)) + 16px);
  padding: 16px;
  border-radius: 28px;
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  text-align: center;
  transition: opacity .15s, transform .15s;
}
.btn-create-look:disabled {
  opacity: .35;
  pointer-events: none;
}
.btn-create-look:active { transform: scale(.97); }

/* =============================================
   PROCESSING VIEW
   ============================================= */
#view-processing {
  align-items: center;
  justify-content: center;
  padding-bottom: 0;
}
.processing-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
}
.processing-title {
  font-size: 22px;
  font-weight: 700;
}
.processing-sub {
  color: var(--text-secondary);
  font-size: 14px;
}
.processing-progress {
  width: 200px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface);
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
  transition: width .4s ease;
}

/* Morphing Loader — GPU-accelerated, 60fps */
.morphing-loader {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 8px;
  will-change: transform;
}

/* Outer ring — morphs circle → rounded-square */
.morph-ring {
  position: absolute;
  inset: 0;
  border: 2.5px solid var(--accent);
  opacity: .6;
  animation: morphShape 3s ease-in-out infinite, spin 2.4s linear infinite;
  will-change: transform, border-radius;
}

/* Middle ring — counter-rotate, offset timing */
.morph-ring.delay-1 {
  inset: 14px;
  border-color: #7c3aed;
  opacity: .45;
  animation: morphShape 3s ease-in-out infinite reverse, spinReverse 3.2s linear infinite;
  animation-delay: -1s;
}

/* Inner ring — fast spin, stays circular */
.morph-ring.delay-2 {
  inset: 28px;
  border-color: var(--accent);
  opacity: .3;
  border-style: dashed;
  animation: spin 1.8s linear infinite;
}

/* Center glowing orb */
.morph-spark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 24px 6px var(--accent-glow), 0 0 48px 12px var(--accent-glow);
  animation: orbPulse 1.6s ease-in-out infinite;
  will-change: transform, box-shadow;
}

/* Floating particle dots (via pseudo-elements on loader) */
.morphing-loader::before,
.morphing-loader::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .7;
  will-change: transform;
}
.morphing-loader::before {
  top: 8px; left: 50%;
  animation: floatParticle1 2.4s ease-in-out infinite;
}
.morphing-loader::after {
  bottom: 8px; right: 14px;
  animation: floatParticle2 2.8s ease-in-out infinite;
}

@keyframes morphShape {
  0%, 100% { border-radius: 50%; }
  33%      { border-radius: 40% 60% 55% 45%; }
  66%      { border-radius: 55% 45% 40% 60%; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes spinReverse {
  to { transform: rotate(-360deg); }
}

@keyframes orbPulse {
  0%, 100% {
    transform: scale(.85);
    box-shadow: 0 0 20px 4px var(--accent-glow), 0 0 40px 8px var(--accent-glow);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 32px 8px var(--accent-glow), 0 0 60px 16px var(--accent-glow);
  }
}

@keyframes floatParticle1 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: .7; }
  50%      { transform: translate(8px, 14px) scale(.6); opacity: .3; }
}
@keyframes floatParticle2 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: .5; }
  50%      { transform: translate(-10px, -12px) scale(.5); opacity: .2; }
}

/* =============================================
   RESULT VIEW
   ============================================= */
#view-result { padding-bottom: 0; }
.result-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px;
}
.result-image {
  width: 100%;
  max-width: 400px;
  border-radius: var(--card-radius);
  background: var(--surface);
  aspect-ratio: 3 / 4;
  object-fit: cover;
}
.result-style-label {
  margin-top: 10px;
  font-weight: 700;
  font-size: 16px;
}
.result-actions {
  display: flex;
  gap: 10px;
  padding: 16px;
  padding-bottom: calc(max(var(--safe-bottom), var(--tg-safe-bottom)) + 16px);
}
.btn-result-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  transition: background .15s;
}
.btn-result-action:active { background: var(--surface-hover); }
.btn-result-action.primary {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
}

/* =============================================
   PROFILE VIEW
   ============================================= */
.profile-content {
  padding: 20px 16px;
}
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 20px;
}
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2dd4bf, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 10px;
}
.profile-name {
  font-size: 20px;
  font-weight: 700;
}
.profile-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* Subscription Card */
.subscription-card {
  background: var(--surface);
  border-radius: var(--card-radius);
  padding: 16px;
  margin-bottom: 24px;
}
.sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.sub-tier {
  font-weight: 700;
  font-size: 15px;
}
.btn-upgrade {
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
}
.credit-box { display: flex; flex-direction: column; gap: 6px; }
.credit-text { font-size: 14px; color: var(--text-secondary); }
.credit-bar-track {
  height: 6px;
  border-radius: 3px;
  background: var(--border-subtle);
  overflow: hidden;
}
.credit-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
  transition: width .4s ease;
}
.credit-total {
  font-size: 12px;
  color: var(--text-secondary);
  align-self: flex-end;
}

/* Profile sections */
.profile-section { margin-bottom: 24px; }
.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.profile-photos {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.profile-photos::-webkit-scrollbar { display: none; }
.profile-photo-slot {
  flex: 0 0 100px;
  height: 100px;
}

/* Profile photo cards with remove button (matches reference UI) */
.profile-photo-card {
  flex: 0 0 calc(33.333% - 7px);
  aspect-ratio: 1;
  border-radius: var(--card-radius);
  overflow: hidden;
  position: relative;
  background: var(--surface);
}
.profile-photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.btn-remove-profile-photo {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  color: #fff;
  z-index: 3;
  transition: background .15s;
}
.btn-remove-profile-photo:active {
  background: rgba(0,0,0,.7);
}

.generations-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.gen-card {
  aspect-ratio: 3 / 4;
  border-radius: var(--card-radius);
  overflow: hidden;
  position: relative;
  background: var(--surface);
  cursor: pointer;
}
.gen-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gen-card .card-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  font-weight: 700;
  font-size: 13px;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 32px 16px;
}

/* All Generations View */
.all-generations-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 16px 20px;
}

/* =============================================
   PAYWALL OVERLAY
   ============================================= */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,.65);
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn .2s ease;
}
.overlay.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.paywall-sheet {
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  animation: slideUp .3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.paywall-close {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 5;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

/* Sparkle particles behind gallery */
.paywall-sheet::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 200px;
  background:
    radial-gradient(1.5px 1.5px at 15% 20%, #ffd700 50%, transparent 55%),
    radial-gradient(1px 1px at 35% 45%, var(--accent) 50%, transparent 55%),
    radial-gradient(1.5px 1.5px at 55% 15%, #ffd700 50%, transparent 55%),
    radial-gradient(1px 1px at 75% 35%, var(--accent) 50%, transparent 55%),
    radial-gradient(1.5px 1.5px at 85% 60%, #ffd700 50%, transparent 55%),
    radial-gradient(1px 1px at 25% 70%, var(--accent) 50%, transparent 55%),
    radial-gradient(1.5px 1.5px at 65% 55%, #ffd700 50%, transparent 55%),
    radial-gradient(1px 1px at 45% 80%, var(--accent) 50%, transparent 55%),
    radial-gradient(1.5px 1.5px at 10% 50%, #ffd700 50%, transparent 55%),
    radial-gradient(1px 1px at 90% 25%, var(--accent) 50%, transparent 55%);
  animation: sparkleFloat 4s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 1;
  opacity: .7;
}

@keyframes sparkleFloat {
  0%   { transform: translateY(0); opacity: .7; }
  100% { transform: translateY(-6px); opacity: .5; }
}

/* Scrolling gallery */
.paywall-gallery {
  height: 160px;
  overflow: hidden;
  position: relative;
  z-index: 2;
}
.paywall-gallery-row {
  display: flex;
  gap: 6px;
  animation: scrollRow 20s linear infinite;
  padding: 4px 0;
}
.paywall-gallery-row.reverse { animation-direction: reverse; }
.paywall-gallery-row .gallery-thumb {
  flex: 0 0 100px;
  height: 72px;
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}
.paywall-gallery-row .gallery-thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
@keyframes scrollRow {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.paywall-body {
  padding: 20px 20px 0;
  text-align: center;
  position: relative;
  z-index: 2;
}
.paywall-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), #7c3aed, var(--accent));
  background-size: 200% 100%;
  animation: badgeShine 3s ease infinite;
  padding: 5px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: .3px;
  box-shadow: 0 2px 12px var(--accent-glow);
}
@keyframes badgeShine {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.paywall-title {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
}
.paywall-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}
.paywall-features {
  list-style: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 4px;
  margin-bottom: 20px;
}
.paywall-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 500;
}
.feature-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.feature-icon.crown { background: rgba(255,215,0,.15); color: #ffd700; }
.feature-icon.star { background: rgba(169,112,255,.15); color: var(--accent); }
.feature-icon.grid { background: rgba(59,130,246,.15); color: #3b82f6; }
.feature-icon.drop { background: rgba(34,197,94,.15); color: #22c55e; }

.btn-purchase {
  margin: 0 20px 24px;
  padding: 16px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  text-align: center;
  transition: transform .15s;
  box-shadow: 0 4px 20px rgba(59, 130, 246, .4);
  position: relative;
  z-index: 2;
}
.btn-purchase:active { transform: scale(.97); }

/* =============================================
   BOTTOM TAB BAR
   ============================================= */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tab-bar-h);
  padding-bottom: max(var(--safe-bottom), var(--tg-safe-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 50;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 20px;
  transition: color .15s;
}
.tab.active { color: var(--text-primary); }
.tab svg { transition: color .15s; }

/* =============================================
   UTILITY & ANIMATIONS
   ============================================= */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--skeleton-mid) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--card-radius);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: calc(var(--tab-bar-h) + max(var(--safe-bottom), var(--tg-safe-bottom)) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  opacity: 0;
  transition: opacity .3s, transform .3s;
  z-index: 200;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Pause animations when app is deactivated (backgrounded) */
body.tg-inactive *,
body.tg-inactive *::before,
body.tg-inactive *::after {
  animation-play-state: paused !important;
}

/* View transitions */
.view { animation: viewFadeIn .25s ease; }
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
