:root {
  --bg: #0f0f14;
  --bg-elevated: #1a1a22;
  --bg-card: #1e1e28;
  --border: #2a2a36;
  --text: #f4f4f6;
  --text-muted: #9a9aa8;
  --accent: #8b5cf6;
  --accent-2: #ec4899;
  --accent-gradient: linear-gradient(135deg, #8b5cf6, #ec4899);
  --success: #22c55e;
  --radius: 16px;
  --radius-sm: 10px;
  --max-width: 480px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; }

.shell {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 32px;
}

/* Topbar */
/* App download banner (topo, persistente) */
.app-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.app-banner .icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--accent-gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.app-banner .text {
  flex: 1;
  min-width: 0;
}
.app-banner .text .t1 {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-banner .text .t2 {
  font-size: 11px;
  color: var(--text-muted);
}
.app-banner .cta {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-gradient);
  color: white;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.app-banner .close {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 16px;
  background: none;
}

/* CTA grande de download na home */
.app-promo {
  margin: 22px 16px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}
.app-promo .icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--accent-gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.app-promo .info { flex: 1; min-width: 0; }
.app-promo .info .t1 {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 2px;
}
.app-promo .info .t2 {
  font-size: 12.5px;
  color: var(--text-muted);
}
.app-promo .badge-store {
  flex-shrink: 0;
  height: 42px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(15,15,20,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .back {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card);
  border-radius: 50%;
  flex-shrink: 0;
}
.topbar .title {
  font-size: 17px;
  font-weight: 700;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand .logo {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--accent-gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.brand .name {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.2px;
}

/* Search */
.search-bar {
  margin: 14px 16px 6px;
}
.search-bar input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 15px;
}
.search-bar input::placeholder { color: var(--text-muted); }

/* Hero */
.hero {
  margin: 8px 16px 18px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--accent-gradient);
  color: white;
}
.hero h1 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}
.hero p {
  font-size: 13px;
  opacity: 0.9;
}

/* Section */
.section { margin: 22px 16px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-head h2 {
  font-size: 16px;
  font-weight: 800;
}
.section-head a {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

/* Category chips */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 9px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.chip.active {
  background: var(--accent-gradient);
  border-color: transparent;
}

/* Grid de packs */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.pack-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.pack-card .thumb {
  aspect-ratio: 1;
  width: 100%;
  background: var(--bg-elevated);
  overflow: hidden;
  position: relative;
}
.pack-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pack-card .badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}
.pack-card .info {
  padding: 10px 12px 12px;
}
.pack-card .info .name {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pack-card .info .meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Wallpaper grid (vertical) */
.grid-wall {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.wall-card {
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  aspect-ratio: 9/16;
  background: var(--bg-card);
}
.wall-card img {
  width: 100%; height: 100%; object-fit: cover;
}
.wall-card .overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 22px 10px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
}
.wall-card .overlay .name {
  font-size: 12px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Category cards (carousel) */
.cat-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-card {
  flex-shrink: 0;
  width: 92px;
  text-align: center;
}
.cat-card .img-wrap {
  width: 92px; height: 92px;
  border-radius: 18px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 6px;
}
.cat-card .img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.cat-card .label {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Página de detalhe (pack/wallpaper) ---- */
.detail-hero {
  position: relative;
}
.detail-hero .cover {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--bg-card);
}
.detail-hero.wallpaper .cover {
  aspect-ratio: 9/16;
  max-height: 70vh;
}

.detail-body {
  padding: 18px 16px;
}
.detail-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
}
.detail-sub {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.stat-row {
  display: flex;
  gap: 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.stat {
  display: flex;
  flex-direction: column;
}
.stat .val {
  font-size: 15px;
  font-weight: 800;
}
.stat .lbl {
  font-size: 11px;
  color: var(--text-muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.tag {
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
}

.cta-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14.5px;
}
.btn-primary {
  background: var(--accent-gradient);
  color: white;
}
.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-block { width: 100%; }

.share-row {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}
.icon-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Stickers preview grid dentro da página do pack */
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.sticker-grid .sticker {
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.sticker-grid .sticker img {
  width: 100%; height: 100%; object-fit: contain;
  padding: 6px;
}

/* Related */
.related-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.related-scroll::-webkit-scrollbar { display: none; }
.related-scroll .pack-card { width: 150px; flex-shrink: 0; }
.related-scroll .wall-card { width: 130px; flex-shrink: 0; }

/* Sticky bottom CTA on detail pages (mobile) */
.sticky-cta {
  position: sticky;
  bottom: 0;
  z-index: 30;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(15,15,20,0.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state .emoji { font-size: 40px; margin-bottom: 10px; }

.footer-note {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 24px 16px 8px;
}

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 24px 16px;
}
.pagination a, .pagination span {
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
}
.pagination .current {
  background: var(--accent-gradient);
  border-color: transparent;
}

@media (min-width: 540px) {
  :root { --max-width: 560px; }
  .grid, .grid-wall { grid-template-columns: repeat(3, 1fr); }
}
