/* AppLanding — mobile-first */
:root {
  --accent: #ee4d2d;
  --accent-dark: #d73211;
  --text: #222;
  --muted: #767676;
  --bg: #f5f5f5;
  --card: #ffffff;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}
a { color: inherit; }
img, video { max-width: 100%; display: block; }

.topbar {
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar a {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
}
.topbar .tagline {
  font-size: 12px;
  opacity: .9;
  font-weight: 400;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 12px 96px; /* chừa chỗ cho sticky CTA */
}
.wide { max-width: 960px; }

/* ---------- Trang bài ---------- */
.carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 8px;
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel img {
  scroll-snap-align: center;
  flex: 0 0 100%;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  background: #000;
  border-radius: var(--radius);
}
.media-hint {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 6px 0 0;
}
.video-wrap { margin-top: 10px; }
.video-wrap video {
  width: 100%;
  max-height: 78vh;
  border-radius: var(--radius);
  background: #000;
}

.content {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
  font-size: 16px;
  white-space: pre-line;
  overflow-wrap: break-word;
}

.buttons { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.buy-btn {
  display: block;
  text-align: center;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  padding: 14px 16px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(238, 77, 45, .35);
}
.buy-btn:active { background: var(--accent-dark); }

.backlink { margin-top: 18px; font-size: 14px; }
.backlink a { color: var(--muted); }

.sticky-cta {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(6px);
  border-top: 1px solid #e5e5e5;
  z-index: 30;
}
.sticky-cta .buy-btn { max-width: 640px; margin: 0 auto; }

/* ---------- Trang danh mục / trang chủ ---------- */
.page-title { font-size: 20px; margin: 8px 4px 12px; }
.page-title small { color: var(--muted); font-weight: 400; font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 820px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.card .thumb {
  aspect-ratio: 1 / 1;
  width: 100%;
  object-fit: cover;
  background: #eee;
}
.card .thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: #ccc;
}
.card .body { padding: 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .title {
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.card .cta {
  margin-top: auto;
  text-align: center;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 8px;
  border-radius: 999px;
}
.card .badge {
  position: absolute;
  font-size: 11px;
  background: rgba(0,0,0,.55);
  color: #fff;
  padding: 2px 6px;
  border-radius: 6px;
  margin: 6px;
}
.card { position: relative; }

.cat-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.cat-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.cat-item .name { font-weight: 700; }
.cat-item .count { color: var(--muted); font-size: 13px; }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 20px 12px 110px;
}
footer a { color: var(--muted); }
