:root {
  --bg: #f7f8fa;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --text: #1a1f2c;
  --text-muted: #6b7280;
  --primary: #ff4757;
  --primary-hover: #e8394b;
  --border: #e5e7eb;
  --accent: #2563eb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 12px;
}

.site-header {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  gap: 12px;
}
.logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--primary);
}
.main-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.main-nav a {
  padding: 6px 10px;
  border-radius: 16px;
  font-size: 0.85rem;
  background: #f1f3f5;
  color: var(--text);
  transition: background 0.15s;
}
.main-nav a:hover { background: #e5e7eb; }

.cat-scroll {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 16px;
  background: #f1f3f5;
  color: var(--text);
  font-size: 0.85rem;
  white-space: nowrap;
  border: 1px solid var(--border);
}
.cat-chip.active {
  background: var(--primary);
  color: white;
}

.main-content { padding: 14px 12px 40px; min-height: 70vh; }

.page-title {
  font-size: 1.3rem;
  margin: 6px 0 14px;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.post-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.post-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.post-card:active { transform: scale(0.98); }
.post-card__thumb {
  position: relative;
  aspect-ratio: 16/10;
  background: #f1f3f5;
  overflow: hidden;
}
.post-card__thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.post-card__placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; color: var(--text-muted);
}
.post-card__badge {
  position: absolute;
  top: 6px; left: 6px;
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 0.7rem;
  padding: 3px 7px;
  border-radius: 10px;
}
.post-card__body { padding: 8px 10px 12px; }
.post-card__title {
  font-size: 0.9rem;
  margin: 0 0 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card__meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn:hover { background: var(--primary-hover); }

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}
.pagination a {
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
.page-info { color: var(--text-muted); font-size: 0.85rem; }

.post-view { padding: 0 0 30px; }
.post-view__title {
  font-size: 1.25rem;
  margin: 8px 0 8px;
}
.post-view__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 14px;
}
.post-type-badge {
  background: var(--primary);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
}
.meta-link { color: var(--accent); }

.video-wrap {
  position: relative;
  width: 100%;
  background: black;
  border-radius: var(--radius);
  overflow: hidden;
}
.video-wrap video {
  width: 100%;
  max-height: 75vh;
  display: block;
  -webkit-user-select: none;
  user-select: none;
}
.post-view__media img, .video-wrap video {
  -webkit-touch-callout: none;
  pointer-events: auto;
}
.image-gallery {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.image-gallery img {
  border-radius: var(--radius);
  width: 100%;
}

.post-view__desc {
  margin: 14px 0;
  color: var(--text);
}
.post-view__body {
  margin: 14px 0;
  font-size: 1rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.share-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 18px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.share-label { font-size: 0.85rem; color: var(--text-muted); }
.share-btn {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  background: #f1f3f5;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
}
.share-fb { background: #1877f2; color: white; border-color: #1877f2; }
.share-tg { background: #0088cc; color: white; border-color: #0088cc; }
.share-copy { background: #f1f3f5; }

.section-title {
  font-size: 1.1rem;
  margin: 24px 0 12px;
  border-left: 3px solid var(--primary);
  padding-left: 10px;
}

.ad-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.94);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  cursor: pointer;
}
.ad-box {
  position: relative;
  width: 100%;
  max-width: 600px;
  background: var(--bg-2);
  border-radius: 12px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.ad-close-x {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 22px;
  height: 22px;
  padding: 0;
  line-height: 20px;
  font-size: 14px;
  color: rgba(255,255,255,0.55);
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  cursor: pointer;
  z-index: 3;
  font-family: Arial, sans-serif;
  text-align: center;
}
.ad-close-x:hover { color: white; background: rgba(0,0,0,0.85); }
.ad-content {
  padding: 14px;
  overflow-y: auto;
  text-align: center;
  flex: 1;
  pointer-events: none;
}
.ad-content * { pointer-events: none; }
.ad-image {
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 6px;
  display: block;
}
.ad-shopee-cta {
  margin-top: 10px;
  padding: 12px;
  background: #ee4d2d;
  color: white;
  border-radius: 8px;
  font-weight: bold;
  text-align: center;
}
.ad-shopee-card {
  padding: 22px;
  background: #ee4d2d;
  color: white;
  border-radius: 8px;
}

.site-footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 20px 0;
  margin-top: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.ad-overlay { background: rgba(0,0,0,0.85); }
.ad-box { background: #ffffff; box-shadow: 0 10px 40px rgba(0,0,0,0.3); }
.ad-content { color: var(--text); }

@media (min-width: 600px) {
  .post-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .post-card__title { font-size: 0.95rem; }
  .page-title { font-size: 1.5rem; }
  .post-view__title { font-size: 1.6rem; }
}
@media (min-width: 900px) {
  .post-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; }
  .main-content { padding: 20px 12px 60px; }
  .header-inner { padding: 14px 12px; }
  .logo { font-size: 1.4rem; }
}
@media (min-width: 1200px) {
  .post-view {
    max-width: 900px;
    margin: 0 auto;
  }
}
