/* ═══════════════════════════════════════════════════════════
   ShinkaCore — Nebula Theme v2.0
   Deep purple/cosmic dark theme with glassmorphism cards,
   split-layout marketplace UI, and a complete design system.
   ═══════════════════════════════════════════════════════════ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ═══════════════════════════════════════════════════════════
   DESIGN TOKENS  (CSS Custom Properties)
   ═══════════════════════════════════════════════════════════ */
:root {
  /* 🎨 Kaze — Japanese Anime Color System */
  --bg-deep:       #0F0E0D;
  --bg-primary:    #1A1817;
  --bg-surface:    #242120;
  --bg-elevated:   #302C2A;
  --accent:        #E63946;
  --accent-light:  #FF6B6B;
  --accent-glow:   rgba(230, 57, 70, 0.3);
  --secondary:     #F4A261;
  --pink:          #FF8C9E;
  --green:         #2A9D8F;
  --text-primary:  #FFF8E7;
  --text-secondary:#E8E0D0;
  --text-tertiary: #A09888;
  --text-muted:    #706858;
  --border:        rgba(230, 57, 70, 0.12);
  --border-light:  rgba(230, 57, 70, 0.25);
  --success:       #2A9D8F;
  --error:         #E63946;

  /* 📐 Spacing */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 20px; --space-5: 24px; --space-6: 28px;
  --space-7: 36px; --space-8: 56px;

  /* 💡 Shadows */
  --shadow-raised:    0 2px 8px rgba(15, 14, 13, 0.4);
  --shadow-floating:  0 4px 16px rgba(230, 57, 70, 0.15);
  --shadow-modal:     0 8px 32px rgba(15, 14, 13, 0.6);
  --shadow-prominent: 0 12px 40px rgba(15, 14, 13, 0.7);
  --shadow-glow:      0 0 20px rgba(230, 57, 70, 0.3);

  /* 🔤 Typography */
  --font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 28px;
  --font-heading: 15px;
  --font-body: 13.5px;
  --font-label: 20px;
  --font-caption: 11.5px;

  /* 🎭 Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 16px;
  --radius-pill: 24px;

  /* 📐 Layout */
  --max-width: 1400px;
  --header-height: 64px;
}

/* ═══════════════════════════════════════════════════════════
   BASE — html / body
   ═══════════════════════════════════════════════════════════ */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--bg-deep);
  background-image:
    radial-gradient(ellipse at 80% 0%, rgba(230, 57, 70, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 100%, rgba(244, 162, 97, 0.06) 0%, transparent 60%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════════════════════
   SCROLLBAR — thin, purple accent
   ═══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 3px;
  border: 1px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ═══════════════════════════════════════════════════════════
   1. TOP HEADER — sticky glass effect with gradient border
   ═══════════════════════════════════════════════════════════ */
.top-header,
.header {
  position: sticky;
  top: 0;
  background: rgba(26, 24, 23, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.top-header::after,
.header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--pink), transparent);
  opacity: 0.5;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-7);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

/* ── Header Left ── */
.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ── Logo ── */
.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  text-decoration: none;
}

.logo-icon {
  font-size: 26px;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent-light), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo-text {
  font-size: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

/* ── Nav Tabs — horizontal category list ── */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 400;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  min-height: 36px;
}
.nav-tab:hover {
  background: rgba(124, 66, 237, 0.08);
  color: var(--text-secondary);
}
.nav-tab.active {
  background: rgba(124, 66, 237, 0.15);
  color: var(--accent-light);
  border: 1px solid var(--border-light);
  box-shadow: inset 0 0 0 1px var(--border-light);
}
.nav-tab .badge,
.nav-badge {
  display: inline-block;
  background: rgba(230, 57, 70, 0.15);
  color: var(--accent-light);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
  min-width: 20px;
  text-align: center;
  line-height: 1.4;
}
.nav-tab.active .badge,
.nav-btn.active .nav-badge {
  background: rgba(230, 57, 70, 0.25);
  color: #fff;
}
.badge-count {
  display: inline-block;
  background: rgba(230, 57, 70, 0.15);
  color: var(--accent-light);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
}

/* ── Header Right — search + key display ── */
.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* ── Search ── */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 200px;
}
.search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(124, 66, 237, 0.15);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-heading);
  font-weight: 400;
  padding: 8px 42px 8px 16px;
  outline: none;
  transition: all 0.2s ease;
  min-height: 38px;
}
.search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}
.search-input:focus {
  border-color: var(--accent);
  background: rgba(124, 66, 237, 0.06);
  box-shadow: 0 0 16px var(--accent-glow);
}
.search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
  pointer-events: none;
  opacity: 0.5;
}

/* ── Header Menu Button (Hamburger) ── */
.header-menu-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  background: rgba(230, 57, 70, 0.08);
  border: 1px solid rgba(230, 57, 70, 0.15);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: all .2s;
}
.header-menu-btn:hover {
  background: rgba(230, 57, 70, 0.15);
  border-color: rgba(230, 57, 70, 0.3);
}
.header-menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all .2s;
}
.header-menu-btn:hover span {
  background: var(--accent-light);
}

/* ── Sidebar ── */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 14, 13, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 199;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.sidebar-overlay.open { opacity: 1; pointer-events: auto; }

.sidebar {
  position: fixed; top: 0; left: 0;
  width: 280px; height: 100vh;
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  z-index: 200;
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 8px 0 24px rgba(0,0,0,.4);
}
.sidebar.open { transform: translateX(0); }

.sidebar-head {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 600;
  color: var(--text-primary);
}
.sidebar-logo-icon {
  font-size: 22px;
  background: linear-gradient(135deg, var(--accent-light), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-close {
  background: transparent; border: none;
  color: var(--text-tertiary); font-size: 20px;
  cursor: pointer; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: all .15s;
}
.sidebar-close:hover { background: rgba(230,57,70,0.1); color: var(--accent-light); }

.sidebar-body {
  flex: 1; overflow-y: auto;
  padding: 8px 12px;
  display: flex; flex-direction: column;
  gap: 2px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 15px; font-weight: 500;
  transition: all .15s;
}
.sidebar-link:hover {
  background: rgba(230,57,70,0.06);
  color: var(--text-secondary);
}
.sidebar-link.active {
  background: rgba(230,57,70,0.1);
  color: var(--accent-light);
}
.sidebar-link-icon { font-size: 18px; width: 24px; text-align: center; }

.sidebar-foot {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.sidebar-foot-link {
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 13px;
  transition: color .15s;
}
.sidebar-foot-link:hover { color: var(--accent-light); }
.header-link {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(244, 162, 97, 0.1);
  border: 1px solid rgba(244, 162, 97, 0.2);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  text-decoration: none;
  transition: all .2s;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.header-link:hover {
  background: rgba(244, 162, 97, 0.15);
  border-color: rgba(244, 162, 97, 0.35);
  color: var(--secondary);
}
.header-link-icon {
  color: var(--secondary);
  font-size: 15px;
  line-height: 1;
}

/* ── Keys Display (backward compat) ── */
.keys-display,
.key-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(244, 162, 97, 0.1);
  border: 1px solid rgba(244, 162, 97, 0.2);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.keys-icon {
  color: var(--secondary);
  font-size: 14px;
}
.keys-display .keys-label,
.key-label {
  font-size: var(--font-caption);
  color: var(--text-tertiary);
}
.keys-display .keys-count,
.key-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--secondary);
}

/* ── Page Header ── */
.page-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-5) var(--space-7) var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.page-title {
  font-size: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════
   2. HERO SECTION
   ═══════════════════════════════════════════════════════════ */
.hero-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 36px var(--space-7) 20px;
}

/* ── Home-only sections: hidden on category pages ── */
.home-only { display: none !important; }
.home-mode .home-only { display: block !important; }

.hero-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.hero-title span {
  color: var(--accent-light);
}

.hero-subtitle {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-top: 8px;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════
   3. CATEGORY PILLS
   ═══════════════════════════════════════════════════════════ */
.category-pills {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px var(--space-7);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.category-pills::-webkit-scrollbar { display: none; }

.pill {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  color: var(--text-tertiary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-family: var(--font-family);
  text-decoration: none;
}
.pill:hover {
  background: rgba(124, 66, 237, 0.08);
  color: var(--text-secondary);
}
.pill.active {
  background: rgba(230, 57, 70, 0.2);
  border-color: rgba(230, 57, 70, 0.3);
  color: var(--accent-light);
}
.pill .pill-icon {
  margin-right: 6px;
  font-size: 15px;
}

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-4) var(--space-7) var(--space-8);
  padding-top: calc(var(--header-height) + var(--space-5));
}

/* ═══════════════════════════════════════════════════════════
   FEATURED / HERO / ADS / LEADERBOARD SECTIONS
   ═══════════════════════════════════════════════════════════ */

/* ── Featured Section ── */
.featured-section {
  display: block; margin-bottom: var(--space-6);
}
.featured-main {
  width: 100%; position: relative; border-radius: var(--radius-xl);
  overflow: hidden; cursor: pointer; min-height: 300px;
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-elevated));
  border: 1px solid var(--border);
}
.featured-img-wrap { position: absolute; inset: 0; z-index: 0; }
.featured-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.featured-img:not([src]) { opacity: 0; }
.featured-info {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 24px; z-index: 1;
  background: linear-gradient(0deg, rgba(15,14,13,0.95) 0%, rgba(15,14,13,0.7) 30%, transparent 100%);
}
.featured-tag {
  background: var(--accent); color: #fff; font-size: 10px;
  font-weight: 700; padding: 3px 10px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
  display: inline-block; margin-bottom: 8px;
}
.featured-title {
  font-size: 20px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 4px; line-height: 1.2;
}
.featured-meta { font-size: 13px; color: var(--text-tertiary); margin-bottom: 12px; }
.featured-dl-btn {
  background: linear-gradient(135deg,var(--accent),#b91c1c); color: #fff;
  border: none; padding: 8px 20px; border-radius: var(--radius-pill);
  font-family: var(--font-family); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .2s;
}
.featured-dl-btn:hover { box-shadow: 0 4px 16px var(--accent-glow); transform: translateY(-1px); }

.featured-side {
  display: none; /* removed - no mini cards */
}
.featured-mini {
  flex: 1; position: relative; border-radius: var(--radius-lg);
  overflow: hidden; cursor: pointer; min-height: 60px;
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-elevated));
  border: 1px solid var(--border);
}
.featured-mini img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.mini-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(15,14,13,0.85) 0%, transparent 50%);
  padding: 10px 12px; display: flex; flex-direction: column;
  justify-content: flex-end;
}
.mini-tag {
  font-size: 9px; font-weight: 700; color: #fff;
  background: var(--accent); padding: 2px 7px; border-radius: 3px;
  display: inline-block; width: fit-content; margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.mini-tag.new-tag { background: var(--secondary); }
.mini-tag.hot-tag { background: #ef4444; }
.mini-tag.top-tag { background: var(--accent); }
.mini-title { font-size: 12px; font-weight: 600; color: var(--text-primary); line-height: 1.2; }

/* ── Section Head ── */
.section-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: var(--space-4); padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.section-head-icon { font-size: 20px; }
.section-head-title {
  font-size: var(--font-heading); font-weight: 600;
  color: var(--text-secondary); margin: 0;
}

/* ── Ads Slider ── */
.ads-section {
  margin-bottom: var(--space-3);
}
.ads-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: var(--space-2);
}
.ads-label {
  font-size: var(--font-heading); color: var(--text-secondary);
  font-weight: 600;
}
.ads-viewport {
  overflow: hidden; border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.ads-track {
  display: flex; gap: 0; overflow-x: auto;
  scroll-snap-type: x mandatory;
}
.ads-slide {
  flex: 0 0 100%; scroll-snap-align: start;
}
.ads-slide img { width: 100%; display: block; border-radius: 8px; }

/* ── Leaderboard ── */
.leaderboard-section { margin-bottom: var(--space-6); }
.leaderboard-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.leaderboard-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px;
  transition: all .2s;
}
.leaderboard-card:hover {
  border-color: rgba(230,57,70,0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(230,57,70,0.1);
}
.lb-rank {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; border: 2px solid; flex-shrink: 0;
}
.lb-medal { font-size: 16px; line-height: 1; }
.lb-num { font-size: 9px; font-weight: 700; color: var(--text-tertiary); }
.lb-thumb {
  width: 52px; height: 52px; border-radius: var(--radius-sm);
  overflow: hidden; background: var(--bg-elevated); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.lb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lb-info { flex: 1; min-width: 0; }
.lb-title {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb-creator { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.leaderboard-loading {
  grid-column: 1/-1; text-align: center; padding: 20px;
  color: var(--text-tertiary);
}

/* ── Sort Bar ── */
.sort-bar {
  display: flex; gap: 6px; margin-bottom: var(--space-4);
}
.sort-btn {
  background: rgba(230,57,70,0.06);
  border: 1px solid var(--border);
  color: var(--text-tertiary); padding: 6px 16px;
  border-radius: var(--radius-pill); font-size: 12px;
  font-family: var(--font-family); cursor: pointer;
  transition: all .15s; font-weight: 500;
}
.sort-btn:hover { background: rgba(230,57,70,0.1); color: var(--text-secondary); }
.sort-btn.active {
  background: rgba(230,57,70,0.15);
  border-color: rgba(230,57,70,0.3);
  color: var(--accent-light);
}

/* ── Items Section ── */
.items-section { margin-bottom: var(--space-8); }

/* ── Home End Message ── */
.home-end-msg {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px 20px;
  color: var(--text-tertiary);
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  margin-top: var(--space-4);
  cursor: pointer;
  transition: all .2s;
}
.home-end-msg:hover {
  border-color: rgba(230,57,70,0.3);
  color: var(--accent-light);
  background: rgba(230,57,70,0.05);
}

/* ═══════════════════════════════════════════════════════════
   4. SPLIT LAYOUT
   ═══════════════════════════════════════════════════════════ */
.split-layout {
  display: flex;
  gap: 24px;
  margin-top: 8px;
  position: relative;
}

.grid-panel {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  transition: max-width 0.3s ease;
}

.detail-panel {
  width: 420px;
  flex-shrink: 0;
  display: none;
}
.detail-panel.open {
  display: block;
}

/* When detail is open, constrain grid panel */
.detail-panel.open ~ .grid-panel,
.split-layout:has(.detail-panel.open) .grid-panel {
  max-width: calc(100% - 444px);
}

/* ═══════════════════════════════════════════════════════════
   5. ITEMS GRID
   ═══════════════════════════════════════════════════════════ */
.items-grid,
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-7);
  padding: 0 0 var(--space-8);
}

/* ═══════════════════════════════════════════════════════════
   6. ITEM CARD — glassmorphism card with hover glow
   ═══════════════════════════════════════════════════════════ */
.item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  text-decoration: none;
  color: inherit;
}

.item-card:hover {
  border-color: rgba(124, 66, 237, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(124, 66, 237, 0.1);
}

/* ── Thumbnail ── */
.item-thumb {
  aspect-ratio: 16 / 9;
  background: var(--bg-elevated);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.item-card:hover .item-thumb img {
  transform: scale(1.05);
}
.item-thumb-placeholder {
  font-size: 40px;
  color: var(--text-muted);
  opacity: 0.35;
}

/* ── Type Badge — pill badge on thumbnail ── */
.item-type-badge {
  position: absolute;
  bottom: var(--space-2);
  left: var(--space-2);
  background: rgba(8, 11, 20, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  color: var(--accent-light);
  font-size: 10px;
  font-weight: 500;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ── Key Badge — top-right (New / Update) ── */
.item-key-badge {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
}
.badge-new {
  background: linear-gradient(135deg, var(--accent), #6D28D9);
  color: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  box-shadow: 0 0 14px var(--accent-glow);
  display: inline-block;
}

.badge-update {
  background: linear-gradient(135deg, var(--secondary), #D97706);
  color: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.3);
  display: inline-block;
}

/* ── Card Body ── */
.item-body {
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
}

.item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-creator {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
  transition: color 0.2s;
}
.item-creator:hover {
  color: var(--accent-light);
}

/* ── Card Footer ── */
.item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 14px;
  gap: var(--space-2);
  margin-top: auto;
}

.item-date {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Download Button ── */
.btn-download {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: linear-gradient(135deg, var(--accent), #6D28D9);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 16px;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  min-height: 34px;
  flex-shrink: 0;
}
.btn-download:hover {
  background: linear-gradient(135deg, #6D28D9, var(--accent));
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-download:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.btn-download:disabled {
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ── Card Button Group ── */
.card-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Update Button (card) ── */
.btn-update {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent-light);
  border-radius: 20px;
  padding: 6px 12px;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 34px;
  flex-shrink: 0;
  white-space: nowrap;
}
.btn-update:hover {
  background: rgba(230, 57, 70, 0.1);
  box-shadow: 0 0 10px var(--accent-glow);
}
.btn-update.done {
  background: var(--bg-surface);
  color: var(--text-tertiary);
  border-color: var(--border);
  cursor: default;
}

/* ── Request Button (card) ── */
.btn-request {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: transparent;
  border: 1px solid var(--secondary);
  color: var(--secondary);
  border-radius: 20px;
  padding: 6px 16px;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 34px;
  flex-shrink: 0;
}
.btn-request:hover {
  background: rgba(244, 162, 97, 0.1);
  box-shadow: 0 0 14px rgba(244, 162, 97, 0.15);
}
.btn-request:disabled {
  background: var(--bg-surface);
  color: var(--text-tertiary);
  cursor: not-allowed;
  border-color: var(--border);
}

/* ── Multi-file download group ── */
.btn-download-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.btn-download-multi {
  font-size: 11px;
  padding: 4px 8px;
  min-width: 0;
  flex: 1;
}

/* ── Disabled button state ── */
.btn-disabled {
  background: var(--bg-elevated);
  color: var(--text-muted);
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
   7. DETAIL PANEL — slide-in detail panel
   ═══════════════════════════════════════════════════════════ */
.detail-panel {
  width: 420px;
  flex-shrink: 0;
  display: none;
}
.detail-panel.open {
  display: block;
}

.detail-inner {
  height: 100%;
  overflow-y: auto;
  padding-right: 4px;
}

/* ── Detail Carousel ── */
.detail-carousel {
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  background: var(--bg-surface);
}

.detail-carousel .dc-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.dc-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 8px;
  pointer-events: none;
}
.dc-nav button {
  pointer-events: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(8, 11, 20, 0.6);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.dc-nav button:hover {
  background: rgba(124, 66, 237, 0.3);
  border-color: var(--accent);
}

.dc-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
}
.dc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}
.dc-dot.active {
  background: var(--accent);
  width: 20px;
  border-radius: 3px;
}

/* ── Detail Tabs ── */
.detail-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin: 16px 0;
  gap: 0;
}
.dt-tab {
  padding: 10px 16px;
  color: var(--text-tertiary);
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-family);
  font-weight: 400;
  margin-bottom: -1px;
}
.dt-tab:hover {
  color: var(--text-secondary);
}
.dt-tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}

.dt-content {
  display: none;
  font-size: var(--font-body);
  color: var(--text-secondary);
  line-height: 1.7;
  padding: 8px 0;
}
.dt-content.active {
  display: block;
}

/* ── Price Box ── */
.price-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}
.pb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pb-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}
.pb-discount {
  background: rgba(245, 158, 11, 0.15);
  color: var(--secondary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
}
.pb-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--secondary);
}
.pb-stars {
  color: var(--secondary);
  font-size: 14px;
}
.pb-reviews {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-left: 4px;
}
.pb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  margin-top: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-family);
  border: none;
}
.pb-btn.primary {
  background: linear-gradient(135deg, var(--accent), #6D28D9);
  color: #fff;
}
.pb-btn.primary:hover {
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}
.pb-btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.pb-btn.secondary:hover {
  background: rgba(124, 66, 237, 0.08);
  border-color: var(--border-light);
}
.pb-icons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}
.pb-icons .icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
}
.pb-icons .icon-btn:hover {
  background: rgba(124, 66, 237, 0.12);
  border-color: var(--accent);
  color: var(--accent-light);
}

/* ── Meta Grid ── */
.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
}
.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.meta-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}
.meta-value {
  font-size: 12px;
  color: var(--text-tertiary);
  word-break: break-all;
}
.uuid-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
}
.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}
.copy-btn:hover {
  background: rgba(124, 66, 237, 0.12);
  border-color: var(--accent);
  color: var(--accent-light);
}

/* ── Detail Content (overlay mode) ── */
.detail-content {
  background: var(--bg-primary);
  max-width: 520px;
  margin-left: auto;
  height: 100%;
  overflow-y: auto;
  padding: 24px;
  border-left: 1px solid var(--border);
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* ═══════════════════════════════════════════════════════════
   8. FILTERS PANEL
   ═══════════════════════════════════════════════════════════ */
.filters-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: var(--space-5);
}

.fp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.fp-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.fp-reset {
  font-size: 12px;
  color: var(--accent-light);
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: var(--font-family);
  transition: color 0.2s ease;
}
.fp-reset:hover {
  color: var(--accent);
}

.fp-section {
  margin-bottom: 16px;
}
.fp-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  display: block;
}

/* ── Slider ── */
.fp-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-elevated);
  outline: none;
  transition: all 0.2s ease;
}
.fp-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
  border: 2px solid var(--bg-primary);
}
.fp-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-primary);
}
.fp-slider:focus {
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ── Checkbox ── */
.fp-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
}
.fp-checkbox input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-light);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.fp-checkbox input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.fp-checkbox input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.fp-checkbox label {
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ── Select ── */
.fp-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 13px;
  width: 100%;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.fp-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ── Apply Button ── */
.fp-apply {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #6D28D9);
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-family);
  margin-top: 8px;
}
.fp-apply:hover {
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════
   LOADING BAR — thin gradient bar (purple → pink → purple)
   ═══════════════════════════════════════════════════════════ */
.loading-bar {
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: var(--space-4);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.loading-bar.active { opacity: 1; }

.loading-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--pink), var(--accent));
  background-size: 200% 100%;
  animation: loading-slide 1.2s ease-in-out infinite;
  border-radius: 2px;
}

@keyframes loading-slide {
  0%   { width: 0%; margin-left: 0; }
  50%  { width: 50%; margin-left: 25%; }
  100% { width: 0%; margin-left: 100%; }
}

/* ═══════════════════════════════════════════════════════════
   LOADING PLACEHOLDER — centered loading state
   ═══════════════════════════════════════════════════════════ */
.loading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) 0;
  gap: var(--space-4);
  color: var(--text-tertiary);
  grid-column: 1 / -1;
}

/* ── Spinner ── */
.loader {
  width: 38px;
  height: 38px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-right-color: var(--pink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════
   9. SKELETON LOADING STATE
   ═══════════════════════════════════════════════════════════ */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-7);
  padding: 0 0 var(--space-8);
}

.skeleton-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.skeleton-thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-surface) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 10px;
  height: 140px;
}

.skeleton-line {
  height: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  margin: 12px 16px 8px;
}
.skeleton-line:last-child {
  width: 60%;
  margin-bottom: 16px;
}

.skeleton-detail {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
}
.skeleton-detail .skeleton-thumb {
  height: 200px;
  margin-bottom: 16px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════════════════
   10. TOAST POPUP — bottom-right toast notification
   ═══════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast-item {
  pointer-events: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-primary);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  max-width: 360px;
  word-break: break-word;
}
.toast-item.show {
  transform: translateX(0);
  opacity: 1;
}
.toast-item.success { border-left: 3px solid var(--success); }
.toast-item.success .toast-icon { color: var(--success); }
.toast-item.error { border-left: 3px solid var(--accent); }
.toast-item.error .toast-icon { color: var(--accent); }
.toast-item.info { border-left: 3px solid var(--secondary); }
.toast-item.info .toast-icon { color: var(--secondary); }
.toast-icon { font-size: 18px; flex-shrink: 0; line-height: 1; }
.toast-msg { flex: 1; line-height: 1.4; }

/* ═══════════════════════════════════════════════════════════
   11. NOTIFICATION / WIDGET — glass popup
   ═══════════════════════════════════════════════════════════ */
.notif-popup {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  background: rgba(21, 27, 43, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  padding: 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  z-index: 9998;
  max-width: 360px;
  min-width: 280px;
}
.notif-title {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 4px;
}
.notif-text {
  font-size: 12px;
  color: var(--text-tertiary);
}
.notif-progress {
  height: 3px;
  background: var(--success);
  border-radius: 2px;
  margin-top: 8px;
  animation: progressPulse 2s infinite ease-in-out;
}

@keyframes progressPulse {
  0%   { width: 30%; }
  50%  { width: 60%; }
  100% { width: 30%; }
}

/* ═══════════════════════════════════════════════════════════
   12. MODAL — glass overlay + container
   ═══════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 20, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 999;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: rgba(21, 27, 43, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  padding: var(--space-6);
  animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Scrollbar inside modal */
.modal::-webkit-scrollbar { width: 4px; }
.modal::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 2px; }

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: rgba(124, 66, 237, 0.08);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 2;
}
.modal-close:hover {
  background: rgba(236, 72, 153, 0.15);
  border-color: rgba(236, 72, 153, 0.3);
  color: var(--pink);
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.modal-title {
  font-size: var(--font-display);
  font-weight: 500;
  color: var(--text-primary);
  padding-right: var(--space-8);
  line-height: 1.2;
}

.modal-creator {
  font-size: var(--font-heading);
  color: var(--text-tertiary);
}

.modal-description {
  font-size: var(--font-body);
  color: var(--text-secondary);
  line-height: 1.7;
}

.modal-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  background: rgba(28, 35, 64, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.modal-meta-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.modal-meta-label {
  font-size: var(--font-caption);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.modal-meta-value {
  font-size: var(--font-body);
  color: var(--text-primary);
  word-break: break-all;
}

.modal-download {
  width: 100%;
  padding: 12px var(--space-5);
  font-size: var(--font-heading);
  justify-content: center;
  margin-top: var(--space-2);
}

/* ═══════════════════════════════════════════════════════════
   13. BACKWARD COMPATIBILITY — old class names used in templates
   ═══════════════════════════════════════════════════════════ */

/* ── Sidebar (legacy) ── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 20, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 98;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.open { opacity: 1; pointer-events: auto; }

/* ── Legacy sidebar backward compat ── */

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-3);
}

.sidebar-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: 18px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.15s ease;
}
.sidebar-close:hover {
  background: rgba(236, 72, 153, 0.12);
  border-color: rgba(236, 72, 153, 0.25);
  color: var(--pink);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) 0;
}

/* Legacy nav buttons (sidebar) — map to new nebula style */
.nav-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-family: var(--font-family);
  font-size: var(--font-heading);
  font-weight: 400;
  padding: 10px var(--space-4);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
  min-height: 44px;
  text-decoration: none;
  position: relative;
}
.nav-btn:hover {
  background: rgba(124, 66, 237, 0.08);
  color: var(--text-secondary);
}
.nav-btn.active {
  background: rgba(124, 66, 237, 0.12);
  color: var(--accent-light);
  box-shadow: inset 0 0 0 1px var(--border-light);
}
.nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 10px var(--accent-glow);
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border);
}

/* Menu toggle (hamburger) */
.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  min-height: 44px;
  min-width: 44px;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-tertiary);
  border-radius: 2px;
  transition: all 0.2s ease;
}
.menu-toggle:hover span {
  background: var(--accent-light);
  box-shadow: 0 0 6px var(--accent-glow);
}

/* ── Badge count (green style) ── */
.badge-count {
  display: inline-block;
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
}

.pb-btn.disabled {
  width: 100%; padding: 12px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 600;
  border: 1px solid var(--border); cursor: default;
  background: rgba(21, 27, 43, 0.6); color: var(--text-muted);
  font-family: var(--font-family);
  margin-top: 8px;
}
.pb-btn.ghost {
  width: 100%; padding: 10px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 500;
  background: transparent; border: 1px solid var(--border); color: var(--text-tertiary);
  cursor: pointer; font-family: var(--font-family);
  transition: all .2s;
}
.pb-btn.ghost:hover { border-color: var(--accent); color: var(--accent-light); }

/* ── Detail Panel Inner ── */
.back-btn-detail {
  background: rgba(124,66,237,0.1); border: 1px solid var(--border);
  color: var(--text-secondary); padding: 6px 14px; border-radius: var(--radius-pill);
  cursor: pointer; font-size: 13px; font-family: var(--font-family);
  transition: all .2s;
}
.back-btn-detail:hover { background: rgba(124,66,237,0.2); color: var(--accent-light); }
.detail-close-btn {
  background: transparent; border: none; color: var(--text-tertiary);
  font-size: 20px; cursor: pointer; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: all .2s;
}
.detail-close-btn:hover { background: rgba(236,72,153,0.1); color: var(--pink); }

/* ── Detail Header ── */
.dh-title {
  font-size: 20px; font-weight: 700; color: var(--text-primary);
  line-height: 1.2; margin-bottom: 8px;
}
.dh-creator {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.dh-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; font-weight: 600;
  flex-shrink: 0;
}

/* ── Tags ── */
.tags-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: rgba(124,66,237,0.08); border: 1px solid var(--border);
  color: var(--text-tertiary); font-size: 11px;
  padding: 3px 10px; border-radius: var(--radius-sm);
}

/* ── DC Arrow ── */
.dc-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(8,11,20,0.7); backdrop-filter: blur(4px);
  border: 1px solid var(--border); color: #fff;
  font-size: 20px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: all .2s; z-index: 5;
}
.dc-arrow:hover { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.dc-arrow-left { left: 8px; }
.dc-arrow-right { right: 8px; }

/* ── Detail Carousel Dots ── */
.dc-dots {
  display: flex; justify-content: center; gap: 6px;
  padding: 10px 0 4px;
}
.dc-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: none; cursor: pointer; transition: all .25s; padding: 0;
}
.dc-dot.active {
  background: var(--accent); width: 22px;
  border-radius: 3px; box-shadow: 0 0 8px var(--accent-glow);
}

/* ── Detail Tags ── */
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.detail-tag { /* same as .tag above */ }

/* ── Max 1200px ── */
@media (max-width: 1200px) {
  .detail-panel {
    width: 380px;
  }
  .detail-panel.open ~ .grid-panel,
  .split-layout:has(.detail-panel.open) .grid-panel {
    max-width: calc(100% - 404px);
  }
}

/* ── Max 1024px — detail becomes overlay ── */
@media (max-width: 1024px) {
  .detail-panel.open {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    background: rgba(8, 11, 20, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: block;
  }
  .detail-panel .detail-inner {
    max-width: 520px;
    margin-left: auto;
  }
  .detail-panel .detail-content {
    animation: slideInRight 0.3s ease;
    max-width: 520px;
    margin-left: auto;
    height: 100%;
    overflow-y: auto;
    padding: 24px;
    border-left: 1px solid var(--border);
    background: var(--bg-primary);
  }
  .detail-panel.open ~ .grid-panel,
  .split-layout:has(.detail-panel.open) .grid-panel {
    max-width: 100%;
  }

  .main-content {
    padding: var(--space-4) var(--space-5) var(--space-7);
  }
  .header-inner {
    padding: 0 var(--space-5);
    gap: var(--space-3);
  }
  .page-header {
    padding: var(--space-4) var(--space-5) var(--space-3);
  }
  .hero-section {
    padding: 28px var(--space-5) 16px;
  }
  .category-pills {
    padding: 4px var(--space-5);
  }
  .nav-tabs {
    gap: var(--space-1);
  }
  .nav-tab {
    padding: 6px 12px;
    font-size: 13px;
  }
  .search-wrapper {
    min-width: 160px;
  }
  .items-grid,
  .item-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
  }
  .skeleton-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
  }
  .keys-display,
  .key-stats {
    padding: 4px 10px;
  }
}

/* ── Max 768px — detail fullscreen, grid 1 col ── */
@media (max-width: 768px) {
  .detail-panel.open .detail-content {
    max-width: 100%;
    width: 100%;
    border-left: none;
    padding: 20px;
    animation: slideInRight 0.3s ease;
  }
  .detail-panel .detail-inner {
    max-width: 100%;
  }

  .main-content {
    padding: var(--space-3) var(--space-3) var(--space-6);
  }
  .header-inner {
    padding: 0 var(--space-3);
    gap: var(--space-2);
    height: 56px;
  }
  .page-header {
    padding: var(--space-3) var(--space-3) var(--space-2);
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
  .page-title {
    font-size: 22px;
  }
  .hero-section {
    padding: 24px var(--space-3) 12px;
  }
  .hero-title {
    font-size: 26px;
  }
  .category-pills {
    padding: 4px var(--space-3);
  }
  .pill {
    padding: 6px 12px;
    font-size: 12px;
  }
  .logo-text {
    display: none;
  }
  .nav-tabs {
    gap: 2px;
  }
  .nav-tab {
    padding: 6px 10px;
    font-size: 12px;
  }
  .nav-tab .badge,
  .nav-badge {
    min-width: 18px;
    padding: 1px 5px;
    font-size: 10px;
  }
  .header-right {
    gap: var(--space-2);
  }
  .search-wrapper {
    min-width: 130px;
  }
  .search-input {
    padding: 6px 36px 6px 12px;
    font-size: 13px;
    min-height: 34px;
  }
  .search-icon {
    right: 10px;
    font-size: 15px;
  }
  .keys-display,
  .key-stats {
    padding: 3px 8px;
  }
  .keys-display .keys-label,
  .key-label {
    display: none;
  }
  .items-grid,
  .item-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  .skeleton-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  .split-layout {
    flex-direction: column;
    gap: 16px;
  }
  .detail-panel {
    width: 100%;
  }
  .modal {
    width: 95%;
    padding: var(--space-4);
  }
  .modal-meta {
    grid-template-columns: 1fr;
  }
  .toast {
    right: var(--space-3);
    bottom: var(--space-3);
    max-width: calc(100vw - var(--space-6));
    font-size: var(--font-caption);
  }
  .notif-popup {
    right: var(--space-3);
    bottom: var(--space-3);
    min-width: unset;
    max-width: calc(100vw - var(--space-6));
  }
  .meta-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Max 480px — compact ── */
@media (max-width: 480px) {
  .hero-section {
    padding: 20px var(--space-3) 10px;
  }
  .hero-title {
    font-size: 22px;
  }
  .hero-subtitle {
    font-size: 12px;
  }
  .header-inner {
    padding: 0 var(--space-2);
    gap: var(--space-1);
    height: 52px;
  }
  .nav-tab {
    padding: 4px 8px;
    font-size: 11px;
  }
  .search-wrapper {
    min-width: 100px;
  }
  .search-input {
    padding: 5px 30px 5px 10px;
    font-size: 12px;
    min-height: 30px;
  }
  .search-icon {
    right: 8px;
    font-size: 13px;
  }
  .keys-display,
  .key-stats {
    padding: 2px 6px;
  }
  .keys-display .keys-count,
  .key-count {
    font-size: 12px;
  }
  .item-body {
    padding: 10px 12px 8px;
  }
  .item-footer {
    padding: 0 12px 10px;
  }
  .btn-download {
    padding: 4px 12px;
    font-size: 11px;
    min-height: 28px;
  }
  .main-content {
    padding: var(--space-2) var(--space-2) var(--space-4);
  }
  .page-header {
    padding: var(--space-2) var(--space-2) var(--space-2);
  }
  .category-pills {
    padding: 4px var(--space-2);
    gap: 6px;
  }
  .pill {
    padding: 5px 10px;
    font-size: 11px;
  }
}
