.library-experience {
  display: grid;
  gap: 18px;
  padding-top: 24px;
  padding-bottom: 26px;
  overflow: hidden;
  border: 1px solid rgba(23, 69, 64, 0.08);
  border-radius: 30px;
  background:
    radial-gradient(circle at 96% 2%, rgba(105, 217, 204, 0.24), transparent 31%),
    linear-gradient(150deg, #f8fbfa 0%, #edf5f2 100%);
}

.library-experience__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.library-experience__header > div {
  display: grid;
  max-width: 620px;
  gap: 7px;
}

.library-experience__eyebrow {
  color: #0b897f;
  font-size: 0.6875rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.library-experience__header h2 {
  margin: 0;
  color: #153b37;
  font-size: clamp(1.5rem, calc(6vw * var(--app-font-scale)), 2.375rem);
  line-height: 1.03;
}

.library-experience__header p {
  margin: 0;
  color: #61736f;
  font-size: 0.875rem;
  line-height: 1.5;
}

.library-saved-toggle {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 46px;
  gap: 8px;
  padding: 10px 13px;
  border: 1px solid rgba(13, 100, 92, 0.13);
  border-radius: 16px;
  color: #285b56;
  background: rgba(255, 255, 255, 0.76);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 750;
}

.library-saved-toggle.active {
  color: #ffffff;
  border-color: transparent;
  background: #0c7970;
}

.library-saved-toggle svg {
  width: 18px;
  height: 18px;
}

.library-saved-toggle b {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 9px;
  background: rgba(102, 199, 189, 0.18);
  font-size: 0.6875rem;
}

.library-continue[hidden] {
  display: none;
}

.library-featured {
  position: relative;
  display: grid;
  width: 100%;
  min-height: clamp(250px, 64vw, 380px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 28px;
  color: #fff;
  background: #0c403b;
  box-shadow: 0 22px 54px rgba(7, 59, 55, 0.22);
  text-align: left;
}

.library-featured__image,
.library-featured__veil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.library-featured__image { object-fit: cover; transition: transform 420ms ease; }
.library-featured__veil { background: linear-gradient(180deg, rgba(5,26,25,.08) 15%, rgba(5,29,27,.9) 92%); }
.library-featured:hover .library-featured__image { transform: scale(1.025); }

.library-featured__copy {
  position: relative;
  z-index: 1;
  align-self: end;
  display: grid;
  max-width: 620px;
  gap: 9px;
  padding: clamp(24px, 7vw, 42px);
}

.library-featured__copy small { color: #91eee4; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.library-featured__copy strong { max-width: 18ch; font-size: clamp(1.75rem, calc(7vw * var(--app-font-scale)), 3.25rem); line-height: 1.02; }
.library-featured__copy span { max-width: 48ch; color: rgba(255,255,255,.78); line-height: 1.45; }
.library-featured__copy b { width: max-content; padding: 8px 11px; border-radius: 999px; color: #123a35; background: #e7d48b; font-size: .72rem; }
.library-featured > svg { position: absolute; z-index: 2; right: 22px; top: 22px; width: 26px; height: 26px; }

.library-continue-card {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 104px;
  gap: 16px;
  padding: 10px 16px 10px 10px;
  overflow: hidden;
  border: 0;
  border-radius: 22px;
  color: #ffffff;
  background: linear-gradient(135deg, #0b6b64, #0c9287);
  box-shadow: 0 18px 38px rgba(10, 96, 88, 0.2);
  text-align: left;
}

.library-continue-card img {
  width: 84px;
  height: 84px;
  border-radius: 16px;
  object-fit: cover;
}

.library-continue-card > span {
  display: grid;
  gap: 4px;
}

.library-continue-card small,
.library-continue-card span span {
  color: rgba(255, 255, 255, 0.72);
}

.library-continue-card strong {
  font-size: 1.0625rem;
  line-height: 1.15;
}

.library-experience__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.library-format-tabs {
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.library-format-tabs::-webkit-scrollbar {
  display: none;
}

.library-format-tabs button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid rgba(28, 78, 73, 0.11);
  border-radius: 999px;
  color: #4d6662;
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 760;
}

.library-format-tabs button.active {
  color: #ffffff;
  border-color: transparent;
  background: #153f3a;
}

.library-experience__status {
  flex: 0 0 auto;
  color: #6f817d;
  font-size: 0.75rem;
  font-weight: 700;
}

.library-premium-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.library-premium-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(18, 68, 63, 0.09);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 42px rgba(27, 63, 59, 0.12);
}

.library-premium-card__open {
  display: grid;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
}

.library-premium-card__visual {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #dcefeb;
}

.library-premium-card__visual::after {
  position: absolute;
  inset: auto 0 0;
  height: 50%;
  content: "";
  background: linear-gradient(transparent, rgba(5, 32, 30, 0.38));
}

.library-premium-card__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 320ms ease;
}

.library-premium-card:hover .library-premium-card__visual img {
  transform: scale(1.035);
}

.library-premium-card__badges,
.library-premium-detail__badges {
  position: absolute;
  z-index: 1;
  inset: 12px 12px auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.library-premium-card__badges {
  right: 64px;
}

.library-premium-badge {
  padding: 7px 10px;
  border-radius: 999px;
  color: #133a36;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 5px 16px rgba(8, 42, 39, 0.12);
  font-size: 0.6875rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.library-premium-badge.is-premium {
  color: #5b4516;
  background: #f5df9a;
}

.library-premium-card__copy {
  display: grid;
  min-height: 142px;
  gap: 9px;
  padding: 20px 20px 15px;
}

.library-premium-card__copy small {
  color: #0a847b;
  font-size: 0.75rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.library-premium-card__copy strong {
  color: #183d39;
  font-size: clamp(1.25rem, calc(5.2vw * var(--app-font-scale)), 1.55rem);
  line-height: 1.12;
}

.library-premium-card__copy span {
  display: -webkit-box;
  overflow: hidden;
  color: #667a76;
  font-size: 0.9375rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.library-premium-card__progress {
  display: grid;
  gap: 7px;
  padding: 0 20px 19px;
}

.library-premium-card__progress small {
  color: #58706c;
  font-size: 0.8125rem;
  font-weight: 720;
}

.library-premium-card__progress i,
.library-premium-detail__progress i {
  position: relative;
  display: block;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe9e5;
}

.library-premium-card__progress i::after,
.library-premium-detail__progress i::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--library-progress, 0%);
  border-radius: inherit;
  content: "";
  background: linear-gradient(90deg, #0b8d83, #66cbbf);
}

.library-premium-card__access {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 12px;
  padding: 0 20px 21px;
  color: #173e39;
}

.library-premium-card__access strong { font-size: 1.0625rem; }
.library-premium-card__access span { color: #71827e; font-size: .8125rem; line-height: 1.35; }
.library-premium-card__access svg { grid-column: 2; grid-row: 1 / span 2; width: 20px; height: 20px; color: #0b8d83; }

.library-premium-detail__inside {
  display: grid;
  gap: 9px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.library-premium-detail__inside li { position: relative; padding-left: 22px; color: #5f7470; line-height: 1.4; }
.library-premium-detail__inside li::before { position: absolute; left: 0; content: "✓"; color: #0b8d83; font-weight: 900; }
.library-premium-detail__access { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 17px; border-radius: 18px; color: #315b56; background: #eaf6f3; }
.library-premium-detail__access strong { color: #0b7169; }

html[data-theme="dark"] .library-premium-card__access { color: #e6fbf7; }
html[data-theme="dark"] .library-premium-card__access span { color: #9fbcb7; }
html[data-theme="dark"] .library-premium-detail__inside li { color: #b1cbc6; }
html[data-theme="dark"] .library-premium-detail__access { color: #b5d5d0; background: #153f3b; }
html[data-theme="dark"] .library-premium-detail__access strong { color: #7fe7dd; }

.library-premium-card__save {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 14px;
  color: #ffffff;
  background: rgba(7, 43, 40, 0.44);
  backdrop-filter: blur(10px);
}

.library-premium-card__save[aria-pressed="true"] {
  color: #16453f;
  background: #f5df9a;
}

.library-premium-empty {
  grid-column: 1 / -1;
  display: grid;
  min-height: 180px;
  place-content: center;
  gap: 8px;
  padding: 28px;
  border: 1px dashed rgba(19, 95, 87, 0.18);
  border-radius: 24px;
  color: #667a76;
  text-align: center;
}

.library-premium-empty strong {
  color: #244b47;
  font-size: 1.0625rem;
}

.library-premium-detail {
  display: grid;
  gap: 18px;
}

.library-premium-detail__cover {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  border-radius: 24px;
}

.library-premium-detail__image {
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
}

.library-premium-detail__content {
  display: grid;
  gap: 11px;
}

.library-premium-detail__eyebrow {
  color: #0b867d;
  font-size: 0.625rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.library-premium-detail__takeaway {
  color: #173e39;
  font-size: 1.25rem;
  line-height: 1.18;
}

.library-premium-detail__copy {
  margin: 0;
  color: #5f7571;
  line-height: 1.55;
}

.library-premium-detail__progress {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  background: #eff7f4;
}

.library-premium-detail__progress span {
  color: #3d615c;
  font-size: 0.75rem;
  font-weight: 750;
}

.library-premium-detail__actions {
  display: grid;
  gap: 8px;
}

.library-premium-detail__actions button {
  min-height: 48px;
}

.library-experience :is(button, [tabindex]):focus-visible {
  outline: 3px solid rgba(18, 167, 158, 0.42);
  outline-offset: 3px;
}

html[data-theme="dark"] .library-experience {
  color: var(--ink, #eef9f7);
  border-color: rgba(126, 221, 211, 0.14);
  background:
    radial-gradient(circle at 96% 2%, rgba(61, 194, 181, 0.15), transparent 33%),
    linear-gradient(150deg, #0f2527 0%, #09191b 100%);
}

html[data-theme="dark"] :is(
  .library-experience__header h2,
  .library-premium-card__copy strong,
  .library-premium-empty strong,
  .library-premium-detail__takeaway
) {
  color: var(--ink, #eef9f7);
}

html[data-theme="dark"] :is(
  .library-experience__header p,
  .library-experience__status,
  .library-premium-card__copy span,
  .library-premium-card__progress small,
  .library-premium-empty,
  .library-premium-detail__copy
) {
  color: var(--ink-soft, #b5cbc7);
}

html[data-theme="dark"] :is(.library-saved-toggle, .library-format-tabs button) {
  color: var(--ink-soft, #b5cbc7);
  border-color: rgba(126, 221, 211, 0.14);
  background: rgba(15, 39, 41, 0.88);
}

html[data-theme="dark"] :is(.library-saved-toggle.active, .library-format-tabs button.active) {
  color: #f2fffd;
  border-color: transparent;
  background: #166b65;
}

html[data-theme="dark"] .library-premium-card {
  border-color: rgba(126, 221, 211, 0.14);
  background: rgba(16, 33, 35, 0.94);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] :is(.library-premium-card__progress i, .library-premium-detail__progress i) {
  background: rgba(126, 221, 211, 0.13);
}

html[data-theme="dark"] .library-premium-detail__progress {
  background: rgba(16, 42, 44, 0.9);
}

html[data-theme="dark"] .library-premium-detail__progress span {
  color: var(--ink-soft, #b5cbc7);
}

html[data-theme="dark"] .library-premium-empty {
  border-color: rgba(126, 221, 211, 0.16);
}

@media (max-width: 640px) {
  .library-experience {
    border-radius: 24px;
  }

  .library-experience__header,
  .library-experience__toolbar {
    display: grid;
  }

  .library-saved-toggle {
    width: 100%;
    justify-content: center;
  }

  .library-format-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    overflow: visible;
  }

  .library-format-tabs button {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
  }

  .library-premium-grid {
    grid-template-columns: 1fr;
  }

  .library-premium-card__copy {
    min-height: 164px;
  }

  .library-premium-card {
    border-radius: 26px;
    box-shadow: 0 20px 44px rgba(17, 65, 60, 0.14);
  }

  .library-continue-card {
    grid-template-columns: 72px 1fr auto;
    gap: 12px;
  }

  .library-continue-card img {
    width: 72px;
    height: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .library-experience *,
  .library-experience *::before,
  .library-experience *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* module=partner; channel=miniapp,web; layer=ui; scenario=library.storefront */
#library.library-storefront { background:transparent;color:var(--ink,#123b49); }
#library.library-storefront > :is(.atlas-grid,.library-tools,.library-catalog) { display:none; }
#library.library-storefront .library-header { display:flex;flex-direction:column;gap:8px;color:var(--ink,#123b49);background:transparent;padding-bottom:12px; }
#library.library-storefront .library-header .view-topbar { order:0;color:inherit; }
#library.library-storefront .library-header h1 { order:1;margin:0;font-size:clamp(1.9rem,7vw,2.65rem);line-height:1.12;letter-spacing:-.04em; }
#library.library-storefront .library-header > .eyebrow { order:2;margin:0;color:var(--muted,#3f6a77);font:500 1rem/1.4 var(--font-body);text-transform:none;letter-spacing:0; }
#library.library-storefront .library-search { order:3;min-height:46px;margin-top:7px;border:1px solid var(--line-glass,#ffffffbd);border-radius:24px;background:var(--surface-glass,#ffffff85);color:var(--muted,#3f6a77);box-shadow:0 4px 14px #194e5810;backdrop-filter:blur(16px); }
#library.library-storefront .library-search input { color:var(--ink,#123b49); }
#library.library-storefront .library-search input::placeholder { color:var(--muted,#3f6a77);opacity:1; }
#library.library-storefront .library-experience { border:0;border-radius:0;background:transparent;gap:12px;padding-top:0;padding-bottom:24px;color:inherit; }
#library.library-storefront .library-experience__toolbar { display:flex;gap:9px;flex-wrap:wrap;align-items:center; }
#library.library-storefront .library-format-tabs { flex-basis:100%;gap:8px; }
#library.library-storefront :is(.library-format-tabs button,.library-saved-toggle,.library-topic-filter,.library-show-more) { min-height:40px;padding:8px 14px;border:1px solid var(--line-glass,#ffffffbf);border-radius:20px;color:var(--ink,#123b49);background:var(--surface-glass,#ffffff80);font-size:.9rem;box-shadow:inset 0 1px 0 #ffffff24;backdrop-filter:blur(14px); }
#library.library-storefront :is(.library-format-tabs button.active,.library-saved-toggle.active) { color:#fff;background:linear-gradient(145deg,#39b9c2,#14768b);border-color:#71d3da;box-shadow:inset 0 1px 8px #ccffff72,0 3px 12px #17859922; }
#library.library-storefront .library-topic-filter { flex:1 1 140px;width:auto;max-width:100%;font:inherit;font-size:.85rem; }
#library.library-storefront .library-saved-toggle { gap:6px;font-size:.8rem;padding-inline:11px; }
#library.library-storefront .library-experience__status { color:var(--muted,#3f6a77);font-size:.78rem; }
#library.library-storefront .library-featured { min-height:clamp(225px,61vw,370px);border-radius:19px;border:1px solid var(--line-glass,#ffffffbf);box-shadow:0 9px 26px #0c3c501d; }
#library.library-storefront .library-featured__veil { background:linear-gradient(180deg,#09313a00 32%,#103c43ed 100%); }
#library.library-storefront .library-featured__copy { padding:19px;gap:8px; }
#library.library-storefront .library-featured__copy small { width:fit-content;padding:5px 9px;border-radius:12px;background:#23545b85;border:1px solid #defaff8f;font-size:.68rem; }
#library.library-storefront .library-featured__copy strong { max-width:24ch;font-size:clamp(1.35rem,5.3vw,2.2rem);line-height:1.13;letter-spacing:-.02em; }
#library.library-storefront .library-featured__copy > span { display:none; }
#library.library-storefront .library-featured__copy b { width:fit-content;font-size:.85rem;color:#fff4c6;background:#193e4799;border:1px solid #f3d68e;border-radius:12px;padding:6px 10px; }
#library.library-storefront .library-premium-grid { grid-template-columns:repeat(2,minmax(0,1fr));gap:11px; }
#library.library-storefront :is(.library-premium-card,.library-continue-card) { background:var(--surface-card,#ffffffb8);border:1px solid var(--line-glass,#ffffffdf);box-shadow:0 5px 16px #133e4e10;backdrop-filter:blur(16px); }
#library.library-storefront .library-premium-card { border-radius:18px; }
#library.library-storefront .library-premium-card__visual { aspect-ratio:4 / 3; }
#library.library-storefront .library-premium-card__badges { padding:9px; }
#library.library-storefront .library-premium-card__badges .is-format { display:none; }
#library.library-storefront .library-premium-card__badges .is-premium { font-size:.58rem;padding:4px 6px; }
#library.library-storefront .library-premium-card__copy { display:flex;flex-direction:column;min-height:0;gap:6px;padding:11px 12px 13px; }
#library.library-storefront .library-premium-card__copy strong { order:0;color:var(--ink,#123b49);font-size:clamp(.96rem,3.8vw,1.2rem);line-height:1.23; }
#library.library-storefront .library-premium-card__copy small { order:1;color:var(--muted,#3f6a77);font-size:.8rem;line-height:1.35;letter-spacing:0;text-transform:none;font-weight:500; }
#library.library-storefront .library-premium-card__copy > span,#library.library-storefront .library-premium-card__access { display:none; }
#library.library-storefront .library-premium-card:not(.has-progress) .library-premium-card__progress { display:none; }
#library.library-storefront .library-premium-card__progress { padding:0 12px 12px; }
#library.library-storefront .library-premium-card__progress small { color:var(--muted,#3f6a77); }
#library.library-storefront .library-premium-card__save { width:40px;height:40px;top:4px;right:4px;border-radius:12px;background:#163e476e;border:0;color:#efffff; }
#library.library-storefront .library-continue-card__copy strong { color:var(--ink,#123b49); }
#library.library-storefront .library-premium-empty { grid-column:1/-1;background:var(--surface-glass,#ffffff85);border-color:var(--line-glass,#c2dadb);color:var(--ink,#123b49); }
.library-show-more { grid-column:1/-1;cursor:pointer;font:inherit; }
#library.library-storefront button:focus-visible,.library-topic-filter:focus-visible { outline:3px solid #56cbd2;outline-offset:3px; }
html[data-theme="dark"] #library.library-storefront :is(.library-format-tabs button.active,.library-saved-toggle.active) { color:#063449;background:linear-gradient(145deg,#efffff,#72d5e7);border-color:#ddffff;box-shadow:0 0 14px #7cd9ec50; }
html[data-theme="dark"] #library.library-storefront .library-featured__veil { background:linear-gradient(180deg,#00304600 28%,#00293bec 100%); }
@media(min-width:900px) { #library.library-storefront .library-premium-grid { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(max-width:350px) { #library.library-storefront .library-premium-grid { grid-template-columns:1fr; } }
@media(prefers-reduced-motion:reduce) { #library.library-storefront .library-premium-card { transition:none!important;transform:none!important; } }

/* Keep full format labels inside narrow mobile chips. */
@media(max-width:420px) { #library.library-storefront .library-format-tabs button { min-width:0;font-size:.75rem;padding-inline:5px; } }
