/* ─── CSS Variables ─────────────────────────────────────────────── */
:root {
  --bg: #0a0a0f;
  --bg-2: #111118;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text-primary: #f0f0ff;
  --text-secondary: #8888aa;
  --text-muted: #555570;
  --accent: #7c6aff;
  --accent-2: #ff6ab0;
  --accent-glow: rgba(124, 106, 255, 0.35);
  --radius: 12px;
  --radius-lg: 18px;
  --nav-h: 64px;
  --cat-bar-h: 48px;
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Segoe UI', Inter, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

/* ─── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #333350; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #4444aa; }

/* ─── Top Navigation ─────────────────────────────────────────────── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
}

.topnav__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.topnav__logo-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.topnav__search {
  flex: 1;
  max-width: 480px;
  min-width: 180px;
  position: relative;
}
.topnav__search input {
  width: 100%;
  height: 38px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0 16px 0 40px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color .2s, background .2s;
}
.topnav__search input::placeholder { color: var(--text-muted); }
.topnav__search input:focus {
  border-color: var(--accent);
  background: rgba(124, 106, 255, 0.08);
}
.topnav__search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.topnav__actions {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.topnav__saved {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  transition: color .18s, border-color .18s, background .18s, transform .18s;
}

.topnav__saved svg {
  opacity: 0.8;
}

.topnav__saved:hover,
.topnav__saved.active {
  color: #fff;
  border-color: rgba(124,106,255,0.45);
  background: rgba(124,106,255,0.16);
}

.topnav__saved:active {
  transform: scale(0.97);
}


/* ─── Category Bar ───────────────────────────────────────────────── */
.catbar {
  position: sticky;
  top: var(--nav-h);
  z-index: 99;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--cat-bar-h);
  display: flex;
  align-items: center;
  overflow-x: auto;
  scroll-behavior: smooth;
  gap: 4px;
  padding: 0 20px;
  scrollbar-width: none;
}
.catbar::-webkit-scrollbar { display: none; }

.catbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  transition: all .18s ease;
  flex-shrink: 0;
}
.catbar__btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
  border-color: var(--border);
}
.catbar__btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 16px var(--accent-glow);
}

/* ─── 404 ───────────────────────────────────────────────────────── */
.not-found {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 48px 20px;
}

.not-found__code {
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 14vw, 10rem);
  line-height: 0.9;
  font-weight: 700;
  color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
}

.not-found__title {
  margin-top: 18px;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: 0;
}

.not-found__text {
  margin-top: 12px;
  max-width: 520px;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
}

.not-found__actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.not-found__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.05);
  font-size: 0.9rem;
  font-weight: 600;
  transition: color .18s, border-color .18s, background .18s, transform .18s;
}

.not-found__btn:hover {
  color: #fff;
  border-color: var(--border-hover);
  background: rgba(255,255,255,0.08);
  transform: translateY(-1px);
}

.not-found__btn--primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

/* ─── Hero (homepage featured drop) ───────────────────────────────── */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 32px;
  max-width: 1200px;
  margin: 20px auto 4px;
  padding: 44px 40px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  min-height: 340px;
}
.hero__bg {
  position: absolute;
  inset: -30px;
  background-size: cover;
  background-position: center;
  filter: blur(28px) brightness(0.5) saturate(1.2);
  transform: scale(1.05);
}
.hero__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(10,10,15,0.88) 0%, rgba(10,10,15,0.55) 55%, rgba(10,10,15,0.25) 100%);
}
.hero__content {
  position: relative;
  flex: 1;
  min-width: 0;
  max-width: 620px;
}
.hero__kicker {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
}
.hero__title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.6vw, 2.7rem);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 14px;
  color: #fff;
  text-wrap: balance;
}
.hero__desc {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.65;
  margin: 0 0 22px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero__cta {
  display: inline-flex;
  align-items: center;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 24px var(--accent-glow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.hero__cta:hover { transform: translateY(-2px); box-shadow: 0 10px 32px var(--accent-glow); }
.hero__art {
  position: relative;
  flex-shrink: 0;
  width: 200px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-hover);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(124, 106, 255, 0.15);
  transition: transform 0.25s;
}
.hero__art:hover { transform: translateY(-4px) scale(1.02); }
.hero__art img { width: 100%; height: auto; aspect-ratio: 9 / 16; object-fit: cover; }
@media (max-width: 760px) {
  .hero { flex-direction: column; padding: 32px 24px; gap: 24px; min-height: 0; }
  .hero__art { width: 150px; }
  .hero__content { max-width: none; }
}

/* ─── Page Header & Breadcrumb ───────────────────────────────────── */.page-header {
  padding: 4px 20px 24px;
  max-width: 1920px;
  margin: 0 auto;
}

.breadcrumb {
  margin-bottom: 8px;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  overflow: hidden;
}

.breadcrumb ol li {
  white-space: nowrap;
  flex-shrink: 0;
}

.breadcrumb ol li:last-child {
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb a:hover {
  color: var(--text-primary);
}

.breadcrumb .sep {
  opacity: 0.5;
  font-size: 0.8em;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0 0 16px 0;
  color: var(--text-primary);
}

.tag-article {
  margin-bottom: 24px;
  color: var(--text-secondary);
  line-height: 1.7;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 25px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.tag-article::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.tag-article h1,
.tag-article h2,
.tag-article h3 {
  color: var(--text-primary);
  margin-top: 0;
  margin-bottom: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tag-article h1 {
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tag-article p {
  margin-bottom: 16px;
}

.tag-article p:last-child {
  margin-bottom: 0;
}

/* ─── Main Content ───────────────────────────────────────────────── */
.main-content {
  padding: 0 20px 60px;
  max-width: 1920px;
  margin: 0 auto;
}

/* ─── Masonry / Waterfall Grid ───────────────────────────────────── */
/* SSR fallback */
.masonry {
  columns: 2;
  column-gap: 12px;
  transition: opacity .25s;
}
@media (max-width: 560px) { .masonry { columns: 1; } }
@media (min-width: 640px)  { .masonry { columns: 3; } }
@media (min-width: 900px)  { .masonry { columns: 4; } }
@media (min-width: 1200px) { .masonry { columns: 5; } }
@media (min-width: 1600px) { .masonry { columns: 6; } }
@media (min-width: 1920px) { .masonry { columns: 7; } }

/* JS Enhanced columns */
.masonry-columns-container {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
}
.masonry-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.masonry-col .card {
  margin-bottom: 0;
}

/* ─── Card ───────────────────────────────────────────────────────── */
.card {
  break-inside: avoid;
  margin-bottom: 12px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease, opacity .3s;
  display: block;
}
/* Entrance animation: subtle slide-in only — never hide cards with opacity:0.
   (The old opacity-based reveal left cards permanently invisible when
   IntersectionObserver misfired in CSS multi-column layout. 2026-10-05.) */
html.js .card {
  animation: cardIn .35s ease both;
}
@keyframes cardIn {
  from { transform: translateY(8px); }
  to { transform: translateY(0); }
}
.card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 16px 40px rgba(0,0,0,0.6), 0 0 0 1px var(--border-hover);
  border-color: var(--border-hover);
  z-index: 2;
}

/* thumbnail */
.card__thumb {
  position: relative;
  width: 100%;
  min-height: 180px;
  overflow: hidden;
  background: #1a1a25;
}
.card__thumb.loaded:not(.is-broken) {
  min-height: 0;
}
/* Image failed even after fallback: show a styled placeholder, never blank. */
.card__thumb.is-broken {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1b1b28 0%, #262638 100%);
}
.card__thumb.is-broken::after {
  content: '🖼️';
  font-size: 42px;
  opacity: 0.35;
}
.card__thumb img,
.card__thumb video {
  width: 100%;
  height: auto;
  display: block;
  transition: transform .35s ease;
  object-fit: cover;
}
.card__thumb video {
  min-height: 180px;
}
.card:hover .card__thumb img,
.card:hover .card__thumb video {
  transform: scale(1.04);
}
.card__thumb-empty,
.card__thumb.is-broken::after {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0;
  background: linear-gradient(135deg, #1a1a25, #22223a);
}
.card__thumb.is-broken::after {
  content: 'MeiTuKong.Net';
}

/* video badge */
.card__play {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 2;
  border: 1px solid rgba(255,255,255,0.2);
  transition: background .2s, transform .2s;
}
.card:hover .card__play {
  background: var(--accent);
  transform: scale(1.1);
}

/* card body */
.card__body {
  padding: 10px 12px 12px;
}
.card__title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.card__cat {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent);
  background: rgba(124,106,255,0.12);
  border-radius: 6px;
  padding: 2px 7px;
  border: 1px solid rgba(124,106,255,0.2);
}
.card__type {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
  padding: 2px 7px;
}
.card__model {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-left: auto;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 2px 7px;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* image placeholder shimmer */
.card__thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #1a1a25 25%, #22223a 50%, #1a1a25 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  z-index: 1;
  transition: opacity .3s;
}
.card__thumb.loaded::before {
  opacity: 0;
  pointer-events: none;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Modal / Detail Overlay ─────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 24px;
  width: 100%;
  max-width: 980px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.96) translateY(12px);
  transition: transform .25s ease;
  position: relative;
}
.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal__close {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background .2s, color .2s;
}
.modal__close:hover { background: rgba(255,255,255,0.15); color: #fff; }

.modal__inner {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 700px) { .modal__inner { flex-direction: column; } }

.modal__media {
  flex: 0 0 55%;
  background: #0d0d18;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.modal__media img,
.modal__media video {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.slide-bg {
  position: absolute;
  top: -5%;
  left: -5%;
  width: 110%;
  height: 110%;
  background-size: cover;
  background-position: center;
  filter: blur(30px) brightness(0.5);
  z-index: 0;
  pointer-events: none;
}
@media (max-width: 700px) { .modal__media { flex: 0 0 40vh; } }

.modal__info {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}
.modal__info::-webkit-scrollbar { width: 4px; }
.modal__info::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.modal__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.4;
}
.modal__badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.modal__badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid;
}
.modal__badge--cat {
  color: var(--accent);
  border-color: rgba(124,106,255,0.3);
  background: rgba(124,106,255,0.1);
}
.modal__badge--type {
  color: var(--accent-2);
  border-color: rgba(255,106,176,0.3);
  background: rgba(255,106,176,0.08);
}
.modal__badge--model {
  color: var(--text-secondary);
  border-color: var(--border);
  background: rgba(255,255,255,0.04);
}

.modal__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.modal__prompt {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 16px;
  scrollbar-width: thin;
}
.modal__prompt::-webkit-scrollbar { width: 4px; }
.modal__prompt::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.modal__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.modal__copy-btn,
.modal__favorite-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  transition: opacity .2s, transform .15s;
}

.modal__favorite-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-hover);
}

.modal__favorite-btn.saved {
  background: rgba(124,106,255,0.18);
  border-color: rgba(124,106,255,0.45);
  color: #fff;
}
.modal__copy-btn:hover,
.modal__favorite-btn:hover { opacity: .9; transform: translateY(-1px); }
.modal__copy-btn:active,
.modal__favorite-btn:active { transform: scale(0.97); }

.modal__tags {
  margin-top: 16px;
}

.modal__tag-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.modal__tag {
  font-size: 0.74rem;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  transition: color .18s, border-color .18s, background .18s;
}

.modal__tag:hover {
  color: #fff;
  border-color: rgba(124,106,255,0.45);
  background: rgba(124,106,255,0.12);
}

/* ─── Loading / Empty states ─────────────────────────────────────── */
.load-more-btn {
  display: block;
  margin: 32px auto 0;
  padding: 12px 32px;
  border-radius: 99px;
  background: rgba(124,106,255,0.12);
  border: 1px solid rgba(124,106,255,0.35);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background .2s, transform .15s;
}
.load-more-btn:hover {
  background: rgba(124,106,255,0.22);
  transform: translateY(-1px);
}
.load-more-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.empty-state svg { margin: 0 auto 16px; opacity: .3; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text-secondary); }

/* ─── Back to Top Button ─────────────────────────────────────────── */
#back-to-top {
  position: fixed;
  bottom: 28px;
  right: 24px;
  z-index: 150;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(124,106,255,0.45);
  opacity: 0;
  transform: translateY(12px) scale(0.85);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
#back-to-top.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}
#back-to-top:hover {
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 6px 28px rgba(124,106,255,0.6);
}

/* ─── Masonry hidden filter ──────────────────────────────────────── */
.card[data-hidden] {
  display: none;
}

/* ─── No results message ─────────────────────────────────────────── */
#no-results {
  display: none;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
#no-results.show { display: block; }

/* ─── Toast ──────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 260;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(24, 24, 34, 0.96);
  border: 1px solid var(--border-hover);
  color: var(--text-primary);
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 560px) {
  :root {
    --nav-h: 112px;
    --cat-bar-h: 52px;
  }

  .topnav {
    min-height: var(--nav-h);
    height: auto;
    padding: 12px 16px 14px;
    gap: 10px 12px;
    flex-wrap: wrap;
    align-content: center;
  }

  .topnav__logo {
    font-size: 1.55rem;
    line-height: 1;
  }

  .topnav__logo-text {
    display: none;
  }

  .topnav__logo-icon {
    width: 32px;
    height: 32px;
  }

  .topnav__actions {
    order: 3;
    margin-left: 0;
  }

  .topnav__saved {
    min-height: 38px;
    padding: 0 10px;
    gap: 0;
  }

  .topnav__saved-text {
    display: none;
  }

  .topnav__search {
    order: 2;
    flex: 1 0 60%;
    max-width: none;
    min-width: 0;
  }

  .topnav__search input {
    height: 40px;
    font-size: 0.9rem;
  }

  .catbar {
    padding: 0 16px;
    gap: 8px;
    scroll-padding-left: 16px;
  }

  .catbar__btn {
    min-height: 34px;
    padding: 6px 13px;
    font-size: 0.86rem;
    border-radius: 10px;
  }

  .catbar__btn span {
    display: none;
  }

  .main-content {
    padding: 16px 14px 72px;
  }

  .card {
    margin-bottom: 14px;
    border-radius: 12px;
  }

  .card__thumb,
  .card__thumb video,
  .card__thumb-empty,
  .card__thumb.is-broken::after {
    min-height: 220px;
  }

  .card__body {
    padding: 13px 14px 14px;
  }

  .card__title {
    font-size: 1rem;
    line-height: 1.35;
    margin-bottom: 10px;
  }

  .card__meta {
    gap: 7px;
  }

  .card__cat,
  .card__type,
  .card__model {
    font-size: 0.78rem;
    padding: 4px 8px;
    border-radius: 8px;
  }

  .card__model {
    margin-left: 0;
    max-width: 100%;
  }

  .modal-overlay {
    padding: 10px;
  }

  .modal {
    max-height: calc(100vh - 20px);
    border-radius: 18px;
  }

  .modal__info {
    padding: 22px 18px;
  }

  .toast {
    bottom: 18px;
  }
}

/* Carousel */
.carousel {
  position: relative;
  max-width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}
.carousel-slide {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.carousel-slide.active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}
.carousel-prev,
.carousel-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: background 0.2s;
  padding-bottom: 4px;
}
.carousel-prev:hover,
.carousel-next:hover {
  background: rgba(0, 0, 0, 0.8);
}
.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }
.carousel-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 10px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}
.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s;
}
.carousel-dot.active {
  background: white;
  transform: scale(1.2);
}

/* ─── NSFW Overlays ──────────────────────────────────────────────────────── */
.card.is-nsfw .card__media {
  filter: blur(30px) saturate(0.8);
  transform: scale(1.1); /* Prevent blur edges showing background */
  transition: filter 0.3s ease, transform 0.3s ease;
}

.card.is-nsfw::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  pointer-events: none;
  z-index: 1;
}

.nsfw-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-align: center;
  pointer-events: none;
  padding: 1rem;
}

.nsfw-overlay .icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.nsfw-overlay .text {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  line-height: 1.4;
}

/* Hide overlay when nsfw is disabled/revealed */
.card:not(.is-nsfw) .nsfw-overlay {
  display: none;
}

/* ─── MTKAI additions ─────────────────────────────────────────────── */

/* Device filter pills */
.devicebar {
  display: flex;
  gap: 8px;
  padding: 16px 24px 20px;
  flex-wrap: wrap;
}
.devicebar__btn {
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  font-size: 0.8rem;
  transition: all .2s;
}
.devicebar__btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.devicebar__btn.active {
  background: rgba(124,106,255,0.15);
  border-color: var(--accent);
  color: var(--text-primary);
}

/* Page sub heading */
.page-sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 8px;
  max-width: 640px;
}

/* Card favorite button */
.card { position: relative; }
.card__link { display: block; }
.card__fav {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,10,15,0.65);
  backdrop-filter: blur(8px);
  color: #fff;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity .2s, transform .2s, color .2s;
  z-index: 2;
}
.card:hover .card__fav, .card__fav.saved { opacity: 1; transform: scale(1); }
.card__fav.saved { color: #ff6ab0; }
.card__fav.saved svg { fill: #ff6ab0; }
.card__fav:hover { color: #ff6ab0; }

/* Saved count badge */
.topnav__saved { position: relative; }
.topnav__saved-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--accent-2);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(20,20,30,0.95);
  border: 1px solid var(--border-hover);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 300;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Site footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 64px;
  padding: 40px 24px 24px;
  background: var(--bg-2);
}
.site-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
}
.site-footer__brand { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: 360px; }
.site-footer__brand span { font-weight: 700; font-size: 1.05rem; }
.site-footer__brand p { width: 100%; color: var(--text-secondary); font-size: 0.85rem; margin-top: 4px; }
.site-footer__links { display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer__links a { color: var(--text-secondary); font-size: 0.85rem; }
.site-footer__links a:hover { color: var(--text-primary); }
.site-footer__copy {
  max-width: 1200px;
  margin: 28px auto 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Detail page */
.detail { max-width: 1200px; margin: 0 auto; }
.detail .breadcrumb { margin: 24px 0 4px; }
.detail__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 4fr);
  gap: 32px;
  margin-top: 20px;
}
@media (max-width: 900px) { .detail__grid { grid-template-columns: 1fr; } }
.detail__media { margin: 0; position: relative; }
.detail__media img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.detail__ai-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: rgba(10,10,15,0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 0.75rem;
  color: var(--text-primary);
}
.detail__title { font-size: 1.6rem; line-height: 1.3; margin: 0 0 12px; }
.detail__desc { color: var(--text-secondary); line-height: 1.65; margin-bottom: 20px; }
.detail__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all .2s;
}
.dl-btn:hover { border-color: var(--border-hover); background: var(--bg-card-hover); transform: translateY(-1px); }
.dl-btn--primary {
  background: linear-gradient(135deg, #7c6aff, #5a4ae0);
  border-color: transparent;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.dl-btn--primary:hover { background: linear-gradient(135deg, #8d7dff, #6a5af0); }
.dl-btn--ghost { background: transparent; }
.dl-btn.saved { color: #ff6ab0; border-color: rgba(255,106,176,0.4); }
.detail__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  margin: 0 0 20px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.detail__meta > div { display: flex; flex-direction: column; gap: 2px; }
.detail__meta dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.detail__meta dd { font-size: 0.9rem; color: var(--text-primary); margin: 0; }
.detail__meta dd a { color: var(--accent); }
.detail__tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.detail__tag {
  padding: 5px 12px;
  border-radius: 99px;
  background: rgba(124,106,255,0.1);
  border: 1px solid rgba(124,106,255,0.25);
  font-size: 0.78rem;
  color: #b9aeff;
}
.detail__colors { display: flex; gap: 8px; }
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border-hover);
}

/* Related */
.related { margin-top: 56px; }
.related__title { font-size: 1.25rem; margin-bottom: 20px; }
.related__grid { margin-top: 0; }

/* Prose (static pages) */
.prose {
  max-width: 760px;
  margin: 24px auto 0;
  line-height: 1.75;
  color: var(--text-secondary);
}
.prose h1 { color: var(--text-primary); font-size: 1.8rem; margin-bottom: 20px; }
.prose h2 { color: var(--text-primary); font-size: 1.2rem; margin: 32px 0 12px; }
.prose p { margin-bottom: 14px; }
.prose ul { margin: 0 0 14px 20px; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--accent); }
.prose em { color: var(--text-muted); }
.prose code {
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.85em;
}
