:root {
  --bg: #0f1218;
  --bg-elev: #171b23;
  --bg-elev-2: #1f242f;
  --border: #2a2f3b;
  --text: #e6e9ef;
  --text-muted: #8b93a7;
  --accent: #3ea6ff;
  --accent-hover: #5cb6ff;
  --danger: #ff5a5a;
  --success: #4ade80;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.2);
}

* { box-sizing: border-box; }

/* Prevent horizontal overflow anywhere */
html { overflow-x: hidden; }
body { overflow-x: hidden; }
img, video, iframe { max-width: 100%; height: auto; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-hover); }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  position: sticky; top: 0; z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 20px;
}
.logo {
  font-weight: 700;
  font-size: 22px;
  color: var(--text);
  display: flex;
  align-items: baseline;
}
.logo-mark {
  color: var(--accent);
}
.main-nav {
  display: flex;
  gap: 20px;
  flex: 0 0 auto;
}
.nav-link {
  color: var(--text);
  font-weight: 500;
  font-size: 15px;
}
.nav-link--muted {
  color: var(--text-muted);
}
.badge {
  background: var(--bg-elev-2);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  margin-left: 4px;
  font-weight: 500;
}
.header-search {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex: 1 1 auto;
  max-width: 400px;
}
.header-search input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
}
.header-search input:focus { outline: none; border-color: var(--accent); }
.header-search button {
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
}

/* Hero */
.hero {
  padding: 60px 0 40px;
  text-align: center;
}
.hero h1 {
  font-size: 40px;
  margin: 0 0 12px;
  line-height: 1.15;
}
.hero-lead {
  color: var(--text-muted);
  font-size: 18px;
  margin: 0 auto 28px;
  max-width: 600px;
}
.hero-search {
  display: flex;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
}
.hero-search input {
  flex: 1;
  padding: 14px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
}
.hero-search button {
  padding: 14px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
}

/* Sections */
.section {
  padding: 40px 0;
  border-top: 1px solid var(--border);
}
.section-title {
  font-size: 24px;
  margin: 0 0 24px;
}
.section-cta {
  text-align: center;
  margin-top: 24px;
}

/* Categories */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.category-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  font-weight: 500;
}
.category-card:hover {
  border-color: transparent;
  background: var(--bg-elev-2);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
}
.category-card .category-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
}
.category-card .category-name { line-height: 1.25; display: flex; flex-direction: column; }
.category-count { color: var(--text-muted); font-size: 12px; font-weight: 400; margin-top: 2px; }

/* Collections */
.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.collection-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  padding: 20px;
  display: block;
}
.collection-card:hover { border-color: var(--accent); }
.collection-card img { width: 100%; height: 160px; object-fit: cover; border-radius: 6px; margin-bottom: 12px; }
.collection-card h3 { margin: 0 0 6px; font-size: 18px; color: var(--text); }
.collection-card p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* Channel grid & card */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.channel-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--text);
  display: block;
  transition: all 0.15s;
}
.channel-card:hover { border-color: var(--accent); background: var(--bg-elev-2); }
.channel-card__head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.channel-card__avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--bg-elev-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px; color: var(--accent);
  flex-shrink: 0;
}
.channel-card__avatar--placeholder { background: linear-gradient(135deg, #3ea6ff33, #5cb6ff33); }
img.channel-card__avatar { object-fit: cover; }
.channel-card__title-wrap { min-width: 0; flex: 1; }
.channel-card__title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-card__username { color: var(--text-muted); font-size: 13px; }
.channel-card__desc { color: var(--text-muted); font-size: 14px; margin: 0 0 10px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; }
.channel-card__title { overflow-wrap: break-word; word-wrap: break-word; }
.channel-card__meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-muted); }
.channel-card__subs { color: var(--accent); font-weight: 500; }
.verified { color: var(--accent); }

/* Catalog layout */
.catalog-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 30px;
  padding: 30px 0;
}
@media (max-width: 800px) {
  .catalog-layout { grid-template-columns: 1fr; }
}
.filters {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  align-self: start;
  position: sticky;
  top: 80px;
}
.filter-block { margin-bottom: 16px; }
.filter-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.filter-block input,
.filter-block select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}
.catalog-head { margin-bottom: 20px; }
.catalog-head h1 { margin: 0 0 4px; font-size: 24px; }
.catalog-count { margin: 0; color: var(--text-muted); font-size: 14px; }
.filter-checks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.filter-checks .check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.filter-checks .check input { width: auto; margin: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.pagination { margin-top: 30px; display: flex; gap: 6px; justify-content: center; align-items: center; flex-wrap: wrap; }
.pagination__btn { padding: 8px 14px; background: var(--bg-elev-2); color: var(--text); border-radius: var(--radius); border: 1px solid var(--border); font-weight: 500; }
.pagination__btn:hover { background: var(--bg-elev); border-color: var(--accent); color: var(--text); }
.pagination__num { padding: 8px 12px; background: var(--bg-elev); color: var(--text); border-radius: var(--radius); border: 1px solid var(--border); min-width: 38px; text-align: center; }
.pagination__num:hover { background: var(--bg-elev-2); border-color: var(--accent); color: var(--text); }
.pagination__num--current { background: var(--accent); color: #fff; border-color: var(--accent); pointer-events: none; }
.pagination__gap { color: var(--text-muted); padding: 0 4px; }

/* Channel page */
.channel-page { padding: 40px 0; max-width: 800px; margin: 0 auto; }
.channel-head { display: flex; gap: 24px; align-items: center; margin-bottom: 40px; }
.channel-head__avatar {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--bg-elev-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 700; color: var(--accent);
  flex-shrink: 0;
}
img.channel-head__avatar { object-fit: cover; }
.channel-head h1 { margin: 0 0 4px; }
.channel-head__username { color: var(--text-muted); margin: 0 0 12px; }
.channel-head__meta { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.channel-desc { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.channel-desc h2 { margin-top: 0; font-size: 18px; color: var(--text-muted); font-weight: 500; }
.channel-desc__original { white-space: pre-wrap; word-wrap: break-word; margin: 0; line-height: 1.6; }
.channel-context { padding: 12px 24px; color: var(--text-muted); font-size: 14px; }
.channel-context__lead { margin: 0; }

/* Collection page */
.collection-page { padding: 40px 0; max-width: 900px; margin: 0 auto; }
.collection-head h1 { margin: 0 0 10px; font-size: 32px; }
.collection-head .lead { color: var(--text-muted); font-size: 18px; }
.collection-body { margin: 32px 0; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--bg-elev-2);
  color: var(--text);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
}
.btn:hover { background: var(--bg-elev); border-color: var(--accent); color: var(--text); }
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-hover); color: #fff; }
.btn--ghost { background: transparent; }

/* Stub page */
.stub { padding: 100px 0; text-align: center; max-width: 600px; margin: 0 auto; }
.stub__badge { display: inline-block; padding: 4px 12px; background: var(--bg-elev-2); border-radius: 20px; font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.stub h1 { font-size: 36px; margin: 0 0 20px; }
.stub p { color: var(--text-muted); font-size: 18px; margin-bottom: 32px; }

/* Empty state */
.empty { padding: 60px 20px; text-align: center; color: var(--text-muted); }

/* 404 */
.not-found { padding: 60px 20px 80px; text-align: center; max-width: 640px; margin: 0 auto; }
.not-found__code { font-size: 96px; font-weight: 800; color: var(--accent); line-height: 1; margin-bottom: 10px; text-shadow: 0 6px 30px rgba(62,166,255,0.25); }
.not-found__title { font-size: 28px; margin: 0 0 12px; }
.not-found__sub { color: var(--text-muted); font-size: 17px; margin-bottom: 28px; line-height: 1.6; }
.not-found__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 40px; }
.not-found__cats-title { color: var(--text-muted); font-size: 14px; margin-bottom: 10px; }
.not-found__cats-list { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.not-found__cats-list a { padding: 8px 14px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 14px; }
.not-found__cats-list a:hover { border-color: var(--accent); background: var(--bg-elev-2); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 30px 0;
  color: var(--text-muted);
  margin-top: 60px;
  font-size: 14px;
}
.site-footer .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.site-footer p { margin: 0; }
.footer-nav { display: flex; gap: 20px; }
.footer-nav a { color: var(--text-muted); }
.footer-nav a:hover { color: var(--accent); }

/* Category intro */
.category-intro {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 0 0 20px;
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
}
.category-intro p { margin: 8px 0; }
.category-intro p:first-child { margin-top: 0; }
.category-intro p:last-child { margin-bottom: 0; }
.category-intro a { color: var(--accent); }
.category-intro strong { color: var(--text); }

/* Blog */
.blog-post { max-width: 780px; margin: 0 auto; padding: 30px 0 60px; }
.blog-post__head { margin-bottom: 30px; }
.blog-post__cat { display: inline-block; padding: 4px 12px; background: var(--bg-elev-2); border-radius: 4px; font-size: 13px; color: var(--accent); margin-bottom: 12px; }
.blog-post__head h1 { font-size: 34px; margin: 0 0 12px; line-height: 1.15; }
.blog-post__date { color: var(--text-muted); font-size: 14px; }
.blog-post__hero { width: 100%; height: auto; border-radius: var(--radius); margin-top: 20px; }
.blog-post__body { font-size: 17px; line-height: 1.7; color: var(--text); }
.blog-post__body h2 { font-size: 24px; margin: 32px 0 12px; }
.blog-post__body h3 { font-size: 20px; margin: 24px 0 10px; }
.blog-post__body p { margin: 14px 0; }
.blog-post__body a { color: var(--accent); text-decoration: underline; }
.blog-post__body ul, .blog-post__body ol { padding-left: 26px; margin: 14px 0; }
.blog-post__body li { margin: 6px 0; }
.blog-post__body blockquote { border-left: 3px solid var(--accent); padding-left: 20px; margin: 20px 0; color: var(--text-muted); }
.blog-post__body img { max-width: 100%; height: auto; border-radius: var(--radius); }

/* Text pages */
.text-page {
  max-width: 780px;
  margin: 0 auto;
  padding: 30px 0 60px;
}
.text-page h1 { font-size: 32px; margin: 0 0 20px; }
.text-page h2 { font-size: 22px; margin: 32px 0 12px; }
.text-page p, .text-page ul, .text-page ol { color: var(--text); margin: 12px 0; }
.text-page ul, .text-page ol { padding-left: 24px; }
.text-page li { margin: 6px 0; color: var(--text-muted); }
.text-page li strong { color: var(--text); }
.text-page .lead { font-size: 18px; color: var(--text-muted); }
.text-page code { background: var(--bg-elev-2); padding: 2px 6px; border-radius: 4px; font-size: 14px; }

.page-head { padding: 30px 0 20px; }
.page-head h1 { margin: 0 0 8px; font-size: 30px; }
.page-head .lead { color: var(--text-muted); font-size: 17px; margin: 0; }

/* Force hidden attribute over display: */
[hidden] { display: none !important; }

/* Cookie notice */
.cookie-notice {
  position: fixed; left: 20px; right: 20px; bottom: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  z-index: 100;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  max-width: 900px; margin: 0 auto;
}
.cookie-notice__text { flex: 1; font-size: 14px; color: var(--text); }
.cookie-notice__text a { color: var(--accent); }
.cookie-notice__btn {
  padding: 8px 20px; background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius); cursor: pointer; font-weight: 600;
}
.cookie-notice__btn:hover { background: var(--accent-hover); }

/* Age gate 18+ */
.age-gate {
  position: fixed; inset: 0; background: rgba(0,0,0,0.9);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
}
.age-gate__box {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  max-width: 460px;
  text-align: center;
  box-shadow: var(--shadow);
}
.age-gate__badge {
  display: inline-block;
  padding: 4px 14px;
  background: var(--danger); color: #fff;
  border-radius: 20px; font-weight: 700; font-size: 14px;
  margin-bottom: 12px;
}
.age-gate h2 { margin: 0 0 12px; font-size: 24px; }
.age-gate p { color: var(--text-muted); margin: 0 0 24px; }
.age-gate__actions { display: flex; gap: 10px; justify-content: center; }
.no-scroll { overflow: hidden; }

/* Breadcrumbs */
.breadcrumbs {
  padding: 14px 0;
  font-size: 14px;
  color: var(--text-muted);
  display: flex; gap: 6px; flex-wrap: wrap;
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { color: var(--border); }
.breadcrumbs .current { color: var(--text); }

/* ==================== Mobile ==================== */
@media (max-width: 900px) {
  .container { padding: 0 14px; }
  .catalog-layout { grid-template-columns: 1fr; gap: 16px; }
  .filters { position: static; padding: 14px; }
  .filter-block { margin-bottom: 12px; }
}

@media (max-width: 700px) {
  html, body { font-size: 15px; }
  .container { padding: 0 12px; }

  /* Header */
  .site-header { position: sticky; top: 0; }
  .header-inner { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .logo { font-size: 18px; }
  .main-nav { order: 3; width: 100%; justify-content: space-between; gap: 8px; font-size: 13px; }
  .main-nav .badge { display: none; }
  .header-search { order: 2; max-width: 100%; width: auto; flex: 1; min-width: 160px; }
  .header-search input { padding: 6px 10px; font-size: 13px; }
  .header-search button { padding: 6px 12px; }

  /* Hero */
  .hero { padding: 32px 0 24px; }
  .hero h1 { font-size: 24px; line-height: 1.2; }
  .hero-lead { font-size: 15px; margin-bottom: 20px; }
  .hero-search { flex-direction: column; gap: 8px; }
  .hero-search input, .hero-search button { padding: 12px 16px; font-size: 15px; }

  /* Section titles */
  .section { padding: 28px 0; }
  .section-title { font-size: 20px; margin-bottom: 16px; }

  /* Category grid */
  .category-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .category-card { padding: 10px 12px; gap: 10px; font-size: 13px; border-radius: 10px; }
  .category-card .category-icon { width: 34px; height: 34px; font-size: 18px; border-radius: 8px; }

  /* Collection grid */
  .collection-grid { grid-template-columns: 1fr; gap: 12px; }
  .collection-card { padding: 16px; }
  .collection-card h3 { font-size: 16px; }

  /* Channel grid */
  .channel-grid { grid-template-columns: 1fr; gap: 10px; }
  .channel-card { padding: 12px; }
  .channel-card__head { gap: 10px; }
  .channel-card__avatar { width: 42px; height: 42px; font-size: 16px; }
  .channel-card__title { font-size: 15px; }
  .channel-card__username { font-size: 12px; }
  .channel-card__desc { font-size: 13px; }

  /* Channel page */
  .channel-page { padding: 20px 0 40px; }
  .channel-head { flex-direction: row; gap: 14px; text-align: left; align-items: flex-start; margin-bottom: 24px; }
  .channel-head__avatar { width: 64px; height: 64px; font-size: 26px; }
  .channel-head h1 { font-size: 20px; line-height: 1.2; }
  .channel-head__username { font-size: 13px; margin-bottom: 8px; }
  .channel-head__meta { font-size: 12px; margin-bottom: 10px; }
  .channel-desc { padding: 16px; margin-bottom: 16px; }
  .channel-desc h2 { font-size: 15px; }

  /* Blog */
  .blog-post { padding: 20px 0 40px; }
  .blog-post__head h1 { font-size: 24px; }
  .blog-post__body { font-size: 15px; line-height: 1.65; }
  .blog-post__body h2 { font-size: 20px; margin-top: 26px; }
  .blog-post__body h3 { font-size: 17px; }

  /* Text pages */
  .text-page { padding: 20px 0 40px; }
  .text-page h1 { font-size: 24px; }
  .text-page h2 { font-size: 18px; margin-top: 24px; }
  .page-head h1 { font-size: 22px; }
  .page-head .lead { font-size: 15px; }

  /* Catalog */
  .catalog-head h1 { font-size: 20px; }

  /* Cookies + Age gate */
  .cookie-notice {
    left: 8px; right: 8px; bottom: 8px;
    padding: 12px 14px; flex-direction: column; align-items: stretch; gap: 8px;
  }
  .cookie-notice__text { font-size: 13px; }
  .cookie-notice__btn { width: 100%; }
  .age-gate__box { padding: 24px 20px; margin: 0 12px; }
  .age-gate h2 { font-size: 20px; }
  .age-gate p { font-size: 15px; }
  .age-gate__actions { flex-direction: column; gap: 8px; }
  .age-gate__actions .btn { width: 100%; }

  /* Footer */
  .site-footer .container { flex-direction: column; text-align: center; gap: 10px; }
  .footer-nav { flex-wrap: wrap; justify-content: center; gap: 12px; font-size: 13px; }

  /* Breadcrumbs */
  .breadcrumbs { font-size: 12px; padding: 10px 0; }
  .breadcrumbs .current { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
}

@media (max-width: 400px) {
  .category-grid { grid-template-columns: 1fr; }
  .main-nav { font-size: 12px; }
  .main-nav a { padding: 2px 4px; }
}
