/* ── Library Browse: Netflix-style ── */

.browse-pills-wrap {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 28px 16px;
  margin: 0 0 20px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}
.browse-pills-wrap::-webkit-scrollbar { display: none; }
@media (max-width: 600px) {
  .browse-pills-wrap { padding: 0 16px 14px; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%); }
}

.browse-pill {
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.65);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .2px;
  cursor: pointer;
  transition: all .2s cubic-bezier(.4,0,.2,1);
  white-space: nowrap;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  position: relative;
}

.browse-pill:hover {
  background: rgba(255,255,255,.09);
  color: #fff;
  border-color: rgba(255,255,255,.16);
  transform: translateY(-1px);
}

.browse-pill.active {
  background: linear-gradient(135deg, var(--primary), rgba(96,165,250,.85));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(var(--primary-rgb, 99,102,241), .35), 0 0 0 1px rgba(255,255,255,.06) inset;
  transform: translateY(-1px);
}
.browse-pill.active:hover {
  filter: brightness(1.1);
}

/* ── Section ── */

.browse-section {
  margin-bottom: 28px;
}

.browse-section-title {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .3px;
  color: #fff;
  margin-bottom: 12px;
}

/* ── Horizontal scroll row ── */

.browse-row-wrap {
  position: relative;
  overflow: hidden;
}

.browse-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}

.browse-row::-webkit-scrollbar {
  height: 6px;
}

.browse-row::-webkit-scrollbar-track {
  background: transparent;
}

.browse-row::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.12);
  border-radius: 3px;
}

/* ── Card ── */

.browse-card {
  flex: 0 0 160px;
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  cursor: pointer;
}

.browse-card:hover {
  transform: scale(1.04);
  border-color: rgba(255,255,255,.14);
  box-shadow: 0 8px 28px rgba(0,0,0,.28), 0 0 16px rgba(var(--primary-rgb, 99,102,241), .12);
  z-index: 2;
}

.browse-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Cover ── */

.browse-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: rgba(255,255,255,.04);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.browse-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.browse-cover-fallback {
  font-size: 36px;
  font-weight: 900;
  color: rgba(255,255,255,.25);
  user-select: none;
}

/* ── Card body ── */

.browse-card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.browse-card-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}

.browse-card-author {
  font-size: 11px;
  color: rgba(255,255,255,.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browse-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: rgba(255,255,255,.65);
  background: rgba(255,255,255,.06);
  border-radius: 6px;
  padding: 2px 7px;
  margin-top: 4px;
  align-self: flex-start;
}

/* ── Tag filter ── */

.browse-tag-filter {
  margin-bottom: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.browse-tag-active {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .15px;
}

.browse-tag-clear {
  appearance: none;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.55);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 0 0 2px;
  transition: color .14s ease;
}

.browse-tag-clear:hover {
  color: #fff;
}

/* ── Empty state ── */

.browse-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 16px;
  gap: 8px;
}

.browse-empty .empty-title {
  font-size: 18px;
  font-weight: 900;
  color: rgba(255,255,255,.7);
}

.browse-empty .empty-text {
  font-size: 14px;
  color: rgba(255,255,255,.45);
}

/* ── Skeleton ── */

.browse-card-sk {
  pointer-events: none;
}

.sk-cover-browse {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 0;
}

/* ── Genre grid (onboarding + settings) ── */

.browse-genre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.browse-genre-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: rgba(255,255,255,.78);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .2px;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
  user-select: none;
}

.browse-genre-chip:hover {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.14);
  color: #fff;
}

.browse-genre-chip.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 12px rgba(var(--primary-rgb, 99,102,241), .3);
}

/* ── Responsive ── */

@media (max-width: 600px) {
  .browse-card {
    flex: 0 0 130px;
  }

  .browse-section-title {
    font-size: 16px;
  }

  .browse-pill {
    padding: 6px 12px;
    font-size: 12px;
  }

  .browse-genre-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }
}

@media (min-width: 1200px) {
  .browse-card {
    flex: 0 0 180px;
  }
}
