.member-library-page {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
  padding: clamp(20px, 4vw, 46px) 0 72px;
}

.member-library-nav {
  display: flex;
  gap: 18px;
  margin-bottom: 20px;
}

.member-library-nav a {
  color: var(--ui-color-muted);
  font-weight: 700;
  text-decoration: none;
}

.member-library-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: clamp(28px, 5vw, 52px);
  border: 1px solid var(--ui-color-border);
  border-radius: 30px;
  background:
    radial-gradient(circle at 85% 15%, color-mix(in srgb, var(--ui-color-accent) 18%, transparent), transparent 31%),
    radial-gradient(circle at 65% 90%, color-mix(in srgb, var(--ui-color-primary) 11%, transparent), transparent 38%),
    var(--ui-color-surface);
}

.member-library-hero h1 {
  margin: 6px 0 12px;
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  line-height: .94;
  letter-spacing: -.065em;
}

.member-library-hero p:last-child {
  max-width: 700px;
  margin-bottom: 0;
  color: var(--ui-color-muted);
  font-size: 1.02rem;
  line-height: 1.65;
}

.member-library-primary-action,
.member-library-next a {
  flex: 0 0 auto;
  padding: 13px 18px;
  border-radius: 999px;
  color: var(--bejiggi-on-accent);
  background: var(--ui-color-primary);
  font-weight: 800;
  text-decoration: none;
}

.member-library-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.member-library-overview article {
  display: grid;
  gap: 6px;
  padding: 20px;
  border: 1px solid var(--ui-color-border);
  border-radius: 20px;
  background: var(--ui-color-surface);
}

.member-library-overview span,
.member-library-discovery span,
.member-library-next > div > span {
  color: var(--ui-color-muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.member-library-overview strong {
  font-size: 1.55rem;
}

.member-library-overview small {
  color: var(--ui-color-muted);
}

.member-library-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 23px 25px;
  border-radius: 22px;
  color: var(--bejiggi-on-promo);
  background: linear-gradient(120deg, var(--bejiggi-promo-start), var(--bejiggi-promo-middle) 58%, var(--bejiggi-promo-end));
  box-shadow: var(--ui-shadow-md);
}

.member-library-next > div > span {
  color: var(--bejiggi-on-promo-subtle);
}

.member-library-next strong {
  display: block;
  margin-top: 7px;
  font-size: 1.15rem;
}

.member-library-next p {
  margin: 5px 0 0;
  color: var(--bejiggi-on-promo-muted);
}

.member-library-next a {
  color: var(--bejiggi-promo-start);
  background: var(--bejiggi-on-promo);
}

.member-library-discovery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.member-library-discovery a {
  min-height: 180px;
  padding: 26px;
  border: 1px solid var(--ui-color-border);
  border-radius: 24px;
  color: inherit;
  background: var(--ui-color-surface);
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease;
}

.member-library-discovery a:hover,
.member-library-discovery a:focus-visible {
  border-color: var(--ui-color-accent);
  transform: translateY(-2px);
}

.member-library-discovery strong {
  display: block;
  margin: 18px 0 8px;
  font-size: 1.35rem;
}

.member-library-discovery p {
  max-width: 440px;
  margin: 0;
  color: var(--ui-color-muted);
  line-height: 1.55;
}

.member-library-workspace {
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid var(--ui-color-border);
  border-radius: 26px;
  background: var(--ui-color-surface);
}

.member-library-workspace__heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.member-library-workspace__heading h2 {
  margin: 4px 0 0;
}

.member-library-workspace__heading > p {
  max-width: 420px;
  margin: 0;
  color: var(--ui-color-muted);
}

.member-library-toolbar {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.member-library-toolbar input,
.member-library-toolbar select {
  min-height: 46px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--ui-color-border);
  border-radius: 12px;
  color: inherit;
  background: var(--ui-color-surface);
  font: inherit;
}

.member-library-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin: 0;
  padding: 18px 0;
  border: 0;
}

.member-library-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.member-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 14px;
}

.member-library-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.member-library-card {
  height: 100%;
  padding: 18px;
  border: 1px solid var(--ui-color-border);
  border-radius: 18px;
  background: var(--ui-color-surface);
}

.member-library-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.member-library-button {
  min-height: 44px;
  padding: 9px 13px;
  border: 1px solid var(--ui-color-border);
  border-radius: 11px;
  color: inherit;
  background: var(--ui-color-surface);
  font: inherit;
  font-weight: 700;
}

.member-library-card__progress {
  width: 100%;
  accent-color: var(--ui-color-accent);
}

.member-library-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 24px 0 0;
}

.member-library-state {
  margin-top: 8px;
  padding: 28px 20px;
  border-radius: 16px;
  color: var(--ui-color-muted);
  background: var(--ui-color-surface-raised);
  text-align: center;
}

.member-library-section:has(.member-library-grid:empty) {
  display: none;
}

.member-library-history ol {
  display: grid;
  gap: 8px;
}

@media (max-width: 820px) {
  .member-library-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .member-library-hero,
  .member-library-workspace__heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .member-library-page {
    width: min(100% - 20px, 1180px);
  }

  .member-library-overview,
  .member-library-discovery,
  .member-library-toolbar {
    grid-template-columns: 1fr;
  }

  .member-library-next {
    align-items: flex-start;
    flex-direction: column;
  }

  .member-library-next a,
  .member-library-primary-action {
    width: 100%;
    text-align: center;
  }

  .member-library-card__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .member-library-page * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
