/* Authenticated library flow — Figma nodes 117:12854 through 117:16643 */
.library-app-page {
  min-width: 320px;
  min-height: 100vh;
  color: var(--brand);
  background: var(--surface);
}

.library-app-page [hidden] { display: none !important; }
.library-app-page button,
.library-app-page input { font-family: var(--font-body); }
.library-app-page a { text-decoration: none; }
.library-app-page button:focus-visible,
.library-app-page a:focus-visible,
.library-app-page input:focus-visible { outline: 3px solid rgba(212, 134, 11, 0.32); outline-offset: 3px; }

.library-app {
  width: calc(100% - 320px);
  min-height: 100vh;
  margin-right: 320px;
  background: var(--surface);
  transition: width .28s ease, margin .28s ease;
}

.sidebar-collapsed .library-app { width: calc(100% - 88px); margin-right: 88px; }

.library-header {
  position: sticky;
  z-index: 900;
  top: 0;
  width: 100%;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(255,255,255,.98);
  border-bottom: .8px solid rgba(27,67,50,.10);
  transition: box-shadow .2s ease;
}

.library-header.is-scrolled { box-shadow: 0 12px 30px rgba(27,67,50,.07); }
.library-header-title { text-align: right; }
.library-header-title h1 { max-width: 520px; margin: 0; overflow: hidden; color: var(--brand); font-size: 20px; font-weight: 700; line-height: 30px; text-overflow: ellipsis; white-space: nowrap; }
.library-header-title p { margin: 0; color: rgba(27,67,50,.5); font-size: 12px; line-height: 18px; }
.library-header-actions { display: flex; align-items: center; gap: 16px; direction: ltr; }
.library-avatar,
.library-language,
.library-back-link { display: inline-flex; align-items: center; justify-content: center; color: var(--brand); background: var(--surface); border: 1px solid var(--brand); }
.library-avatar { width: 38px; height: 38px; color: var(--surface); background: var(--brand); border: 0; border-radius: 50%; font-size: 14px; font-weight: 700; }
.library-language { min-width: 105px; height: 48px; padding-inline: 24px; border-radius: 12px; font-size: 16px; }
.library-back-link { min-height: 40px; padding: 8px 17px; border-color: rgba(27,67,50,.18); border-radius: 12px; font-size: 14px; white-space: nowrap; }

.library-index-main { width: min(1088px, calc(100% - 64px)); margin: 0 auto; padding: 32px 0 96px; }
.library-index-hero { min-height: 0; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .9fr); align-items: center; gap: 24px; margin-bottom: 20px; direction: rtl; }
.library-index-hero-copy { display: flex; flex-direction: column; align-items: flex-start; text-align: right; }
.library-index-hero-copy > span { margin-bottom: 8px; color: var(--accent); font-size: 13px; }
.library-index-hero h2 { max-width: 610px; margin: 0 0 6px; color: var(--brand); font-size: 24px; font-weight: 700; line-height: 1.3; }
.library-index-hero p { max-width: 620px; margin: 0; color: rgba(27,67,50,.68); font-size: 14px; line-height: 22px; }
.library-index-hero figure { width: 100%; height: 96px; margin: 0; overflow: hidden; background: var(--canvas); border-radius: 16px; }
.library-index-hero img { width: 100%; height: 100%; object-fit: cover; }

.library-discovery { margin-bottom: 32px; }
.library-index-search { width: min(640px, 100%); margin: 0 0 32px auto; }
.library-index-search label { display: block; margin-bottom: 8px; color: rgba(27,67,50,.62); font-size: 14px; }
.library-index-search > div { position: relative; }
.library-index-search input { width: 100%; height: 54px; padding: 12px 52px 12px 18px; color: var(--brand); background: var(--surface); border: 1px solid rgba(27,67,50,.18); border-radius: 16px; outline: 0; font-size: 15px; }
.library-index-search input::placeholder { color: rgba(27,67,50,.42); }
.library-index-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(27,67,50,.08); }
.library-index-search img { position: absolute; top: 18px; right: 18px; width: 19px; height: 19px; object-fit: contain; opacity: .66; }

.library-type-filters { display: flex; direction: rtl; justify-content: flex-start; gap: 8px; margin-bottom: 34px; overflow-x: auto; padding: 1px 0 4px; scrollbar-width: none; }
.library-type-filters::-webkit-scrollbar { display: none; }
.library-type-filters button { min-width: max-content; height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 24px; color: var(--brand); background: var(--surface); border: 1px solid var(--brand); border-radius: 12px; font-size: 15px; }
.library-type-filters button span { font-size: 15px; opacity: .76; }
.library-type-filters button.is-active { color: var(--surface); background: var(--brand); }

.library-topic-filters { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 2px 0; padding: 0 8px; background: var(--canvas); border-radius: 16px; }
.library-topic-filters button { min-height: 36px; padding: 8px 15px; color: rgba(27,67,50,.62); background: transparent; border: 0; border-radius: 12px; font-size: 12px; }
.library-topic-filters button.is-active { color: var(--surface); background: var(--brand); font-weight: 700; }
.library-clear { display: block; margin: 16px 0 0 auto; color: #d94e2e; background: transparent; border: 0; font-size: 14px; font-weight: 600; }

.library-results { display: flex; flex-direction: column; gap: 32px; }
.library-results-section > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.library-results-section > header h2 { margin: 0; color: var(--brand); font-size: 24px; font-weight: 700; }
.library-results-section > header button { color: var(--brand); background: transparent; border: 0; font-size: 13px; }

.library-featured-book { min-height: 260px; display: grid; grid-template-columns: minmax(0,1fr) minmax(340px, .86fr); overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; }
.library-featured-book figure { min-height: 260px; margin: 0; overflow: hidden; }
.library-featured-book img { width: 30%; height: 100%; object-fit: cover; }
.library-featured-book > div { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 30px; }
.library-featured-book span { align-self: flex-start; padding: 7px 13px; color: var(--accent); background: rgba(212,134,11,.14); border-radius: 999px; font-size: 12px; }
.library-featured-book h3 { margin: 12px 0 8px; color: var(--brand); font-size: 24px; font-weight: 700; line-height: 1.45; }
.library-featured-book p { margin: 0 0 18px; color: rgba(27,67,50,.66); font-size: 14px; line-height: 25px; }

.library-card-grid,
.library-media-grid,
.library-book-grid,
.library-short-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.library-card-item { position: relative; min-height: 270px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; padding: 18px; color: var(--surface); background: var(--brand); border-radius: 18px; }
.library-card-item::after { position: absolute; inset: 0; content: ""; background: linear-gradient(180deg, transparent 22%, rgba(8,34,24,.92)); }
.library-card-item img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.library-card-item > *:not(img) { position: relative; z-index: 1; }
.library-card-item small { opacity: .8; }
.library-card-item h3 { margin: 7px 0 13px; color: var(--surface); font-size: 16px; line-height: 25px; }
.library-card-item a { align-self: flex-start; padding: 8px 15px; color: var(--brand); background: var(--surface); border-radius: 999px; font-size: 12px; }

.library-media-item { display: flex; flex-direction: column; gap: 12px; }
.library-media-thumb { position: relative; height: 190px; overflow: hidden; background: var(--canvas); border-radius: 16px; }
.library-media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.library-media-thumb i { position: absolute; top: 50%; left: 50%; width: 48px; height: 48px; display: grid; place-items: center; color: var(--surface); background: rgba(27,67,50,.88); border-radius: 50%; transform: translate(-50%,-50%); font-style: normal; }
.library-media-thumb time { position: absolute; bottom: 8px; left: 8px; padding: 3px 8px; color: var(--surface); background: rgba(27,67,50,.88); border-radius: 999px; font-size: 11px; }
.library-media-item h3 { margin: 0; color: var(--brand); font-size: 16px; font-weight: 700; line-height: 25px; }
.library-media-item p { margin: 0; color: rgba(27,67,50,.56); font-size: 12px; line-height: 20px; }

.library-book-item figure { height: 160px; margin: 0 0 12px; overflow: hidden; background: var(--canvas); border-radius: 16px; }
.library-book-item img { width: 100%; height: 100%; object-fit: cover; }
.library-book-item h3 { min-height: 50px; margin: 0 0 10px; color: var(--brand); font-size: 16px; line-height: 24px; }
.library-book-item a { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; padding: 7px 16px; color: var(--brand); border: 1px solid rgba(27,67,50,.28); border-radius: 11px; font-size: 12px; }

.library-audio-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.library-audio-item { min-height: 86px; display: grid; grid-template-columns: 64px minmax(0,1fr) 38px; align-items: center; gap: 12px; padding: 10px; direction: ltr; border: 1px solid rgba(27,67,50,.14); border-radius: 16px; }
.library-audio-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; }
.library-audio-item div { direction: rtl; text-align: right; }
.library-audio-item h3 { margin: 0 0 4px; color: var(--brand); font-size: 13px; line-height: 20px; }
.library-audio-item small { color: rgba(27,67,50,.48); font-size: 10px; }
.library-audio-item button { width: 36px; height: 36px; color: var(--surface); background: var(--brand); border: 0; border-radius: 50%; }

.library-article-list,
.library-question-list { display: grid; gap: 12px; }
.library-article-item { min-height: 128px; display: grid; grid-template-columns: 160px minmax(0,1fr); align-items: center; gap: 24px; padding: 12px; direction: ltr; border: 1px solid var(--line); border-radius: 16px; }
.library-article-item img { width: 160px; height: 104px; object-fit: cover; border-radius: 12px; }
.library-article-item div { direction: rtl; text-align: right; }
.library-article-item h3 { margin: 0 0 7px; color: var(--brand); font-size: 18px; }
.library-article-item p { margin: 0 0 6px; color: rgba(27,67,50,.6); font-size: 13px; line-height: 22px; }
.library-article-item a { color: rgba(27,67,50,.58); font-size: 11px; }

.library-short-item { position: relative; height: 290px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; padding: 14px; border-radius: 18px; }
.library-short-item::after { position: absolute; inset: 0; content: ""; background: linear-gradient(180deg,transparent 30%,rgba(8,34,24,.92)); }
.library-short-item img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.library-short-item > *:not(img) { position: relative; z-index: 1; }
.library-short-item i { position: absolute; z-index: 2; top: 50%; left: 50%; width: 42px; height: 42px; display: grid; place-items: center; color: var(--brand); background: var(--surface); border-radius: 50%; transform: translate(-50%,-50%); font-style: normal; }
.library-short-item h3 { margin: 0; color: var(--surface); font-size: 14px; line-height: 22px; }
.library-short-item time { color: rgba(255,255,255,.8); font-size: 10px; }

.library-question-item { display: grid; grid-template-columns: 28px minmax(0,1fr); gap: 14px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 16px; }
.library-question-item i { width: 20px; height: 20px; display: grid; place-items: center; color: var(--accent); border: 1px solid var(--accent); border-radius: 50%; font-style: normal; font-size: 11px; }
.library-question-item h3 { margin: 0 0 6px; color: var(--brand); font-size: 15px; }
.library-question-item p { margin: 0 0 7px; color: rgba(27,67,50,.58); font-size: 12px; line-height: 20px; }
.library-question-item a { color: var(--brand); font-size: 11px; text-decoration: underline; }

.library-no-results { width: min(600px,100%); margin: 24px 0 0 auto; padding: 40px; border: 1px solid rgba(27,67,50,.14); border-radius: 22px; text-align: right; }
.library-no-results h2 { margin: 0 0 6px; font-size: 24px; }
.library-no-results p { margin: 0 0 18px; color: rgba(27,67,50,.6); }
.library-no-results > div { display: flex; gap: 10px; }

/* Shared content pages */
.library-detail-main { width: min(1088px, calc(100% - 48px)); display: grid; grid-template-columns: 300px minmax(0,1fr); grid-template-areas: "aside content"; gap: 24px; margin: 0 auto; padding: 48px 0 96px; direction: ltr; }
.library-content-aside { grid-area: aside; display: flex; flex-direction: column; gap: 16px; direction: rtl; }
.library-detail-content { grid-area: content; min-width: 0; direction: rtl; text-align: right; }
.library-meta-card,
.library-practice-card,
.library-review-card { padding: 24px; border-radius: 20px; }
.library-meta-card { border: 1px solid rgba(27,67,50,.14); }
.library-meta-card dl { display: grid; gap: 16px; margin: 0; }
.library-meta-card dl > div { display: grid; gap: 3px; }
.library-meta-card dt { color: rgba(27,67,50,.46); font-size: 13px; font-weight: 600; }
.library-meta-card dd { margin: 0; color: var(--brand); font-size: 14px; }
.library-practice-card { display: grid; gap: 8px; background: var(--canvas); }
.library-practice-card span { color: rgba(27,67,50,.58); font-size: 14px; font-weight: 700; }
.library-practice-card .btn { min-height: 44px; display: grid; place-items: center; font-size: 14px; }
.library-review-card { background: var(--canvas); border: 1px solid var(--line); }
.library-review-card strong { display: block; margin-bottom: 5px; font-size: 14px; }
.library-review-card p { margin: 0; color: rgba(27,67,50,.6); font-size: 12px; line-height: 21px; }
.library-aside-back { min-height: 44px; display: grid; place-items: center; color: var(--brand); border: 1px solid rgba(27,67,50,.18); border-radius: 12px; font-size: 14px; }

.library-detail-tags { display: flex; flex-direction: row-reverse; justify-content: flex-start; align-items: center; gap: 8px; margin-bottom: 32px; }
.library-detail-tags span { padding: 8px 16px; color: var(--brand); background: rgba(27,67,50,.1); border-radius: 999px; font-size: 12px; font-weight: 700; }
.library-detail-tags small { color: rgba(27,67,50,.48); font-size: 12px; }
.library-detail-hero { margin-bottom: 32px; }
.detail-question-box { padding: 24px 32px; background: var(--canvas); border-radius: 20px; }
.detail-question-box span { display: block; margin-bottom: 10px; font-size: 14px; font-weight: 700; }
.detail-question-box h2 { margin: 0; color: var(--brand); font-size: 28px; font-weight: 700; line-height: 42px; }

.detail-media-split { display: grid; grid-template-columns: minmax(0,1fr) 256px; align-items: stretch; gap: 32px; }
.detail-media-split > div:first-child { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.detail-media-split h2,
.detail-video-copy h2 { margin: 0 0 10px; color: var(--brand); font-size: 32px; line-height: 1.35; }
.detail-media-split p,
.detail-video-copy p { margin: 0; color: rgba(27,67,50,.66); font-size: 16px; line-height: 28px; }
.detail-media-image { position: relative; height: 256px; overflow: hidden; background: var(--canvas); border-radius: 18px; }
.detail-media-image img { width: 100%; height: 100%; object-fit: cover; }
.detail-media-image.detail-media-video { background: #0c2018; }
.detail-media-image video { display: block; width: 100%; height: 100%; object-fit: contain; background: #0c2018; }
.detail-duration { position: absolute; bottom: 8px; left: 8px; padding: 3px 9px; color: var(--surface); background: rgba(27,67,50,.9); border-radius: 999px; font-size: 11px; pointer-events: none; }
.detail-audio-player { width: 100%; margin-top: 18px; padding: 14px 16px; background: var(--canvas); border-radius: 16px; }
.detail-audio-player audio { display: block; width: 100%; }
.detail-action-row { display: flex; gap: 8px; margin-top: 14px; }
.detail-action-row button,
.detail-action-row a { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 24px; color: var(--brand); background: var(--surface); border: 1px solid var(--brand); border-radius: 12px; }
.detail-action-row .is-primary { color: var(--surface); background: var(--brand); }

/* Audio detail page (Figma 149:31161) */
.detail-audio-layout { display: grid; grid-template-columns: minmax(0,1fr) 256px; align-items: stretch; gap: 32px; direction: ltr; }
.detail-audio-layout > .detail-audio-copy { direction: rtl; text-align: right; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.detail-audio-layout > .detail-audio-copy h2 { margin: 0 0 10px; color: var(--brand); font-size: 32px; line-height: 1.35; }
.detail-audio-layout > .detail-audio-copy p { margin: 0; color: rgba(27,67,50,.66); font-size: 16px; line-height: 28px; }
.detail-audio-cover { position: relative; height: 256px; margin: 0; overflow: hidden; background: var(--canvas); border-radius: 18px; }
.detail-audio-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-audio-cover figcaption { position: absolute; bottom: 8px; left: 8px; padding: 3px 9px; color: var(--surface); background: rgba(8,34,24,.6); border-radius: 999px; font-size: 10px; }

.detail-video-frame { position: relative; height: 420px; overflow: hidden; background: #0c2018; border-radius: 20px; }
.detail-video-frame img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.72); }
.detail-video-frame video { display: block; width: 100%; height: 100%; object-fit: contain; background: #0c2018; }
.detail-video-copy { padding-top: 28px; }
.detail-card-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(320px,.82fr); gap: 32px; }
.detail-card-visual { min-width: 0; }
.detail-card-layout figure { position: relative; height: 270px; margin: 0; overflow: hidden; border-radius: 20px; }
.detail-card-layout figure img { width: 100%; height: 100%; object-fit: cover; }
.detail-card-layout > div:not(.detail-card-visual) { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.detail-card-layout h2 { margin: 0 0 10px; font-size: 30px; line-height: 1.4; }
.detail-card-layout p { margin: 0; color: var(--muted-brand); font-size: 16px; line-height: 28px; }
.detail-card-tags { display: flex; gap: 8px; margin-top: 12px; }
.detail-card-tags span { padding: 7px 14px; background: var(--canvas); border-radius: 999px; font-size: 12px; }
.detail-card-image-button { width: 100%; min-height: 48px; margin-top: 10px; color: var(--brand); background: var(--surface); border: 1px solid var(--brand); border-radius: 12px; }

/* Card zoom controls */
.detail-card-zoom-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.detail-card-zoom-controls button { width: 34px; height: 34px; display: grid; place-items: center; color: var(--brand); background: var(--surface); border: 1px solid rgba(27,67,50,.35); border-radius: 50%; font-size: 18px; line-height: 1; }
.detail-card-zoom-controls button:hover,
.detail-card-zoom-controls button:focus-visible { color: var(--surface); background: var(--brand); border-color: var(--brand); }
.detail-card-zoom-controls button:disabled { opacity: .4; cursor: not-allowed; }
.detail-card-zoom-controls span { min-width: 46px; color: rgba(27,67,50,.6); font-size: 13px; font-weight: 700; text-align: center; }
.detail-card-zoom-target { font-size: 1em; transition: font-size .15s ease; }
.detail-card-zoom-target h2 { font-size: 1.875em; margin: 0 0 10px; line-height: 1.4; }
.detail-card-zoom-target p { font-size: 1em; margin: 0; color: var(--muted-brand); line-height: 1.75; }
.detail-card-zoom-target .detail-card-tags { font-size: 1em; }

/* In-page book reader: real, native PDF viewing via an embedded <iframe> (Task 1) */
.library-reader-modal { position: fixed; z-index: 1400; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(10,29,22,.6); }
.library-reader-panel { width: min(720px,100%); max-height: min(720px,86vh); display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border-radius: 22px; box-shadow: 0 30px 70px rgba(10,29,22,.35); direction: rtl; text-align: right; }
.library-reader-panel header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.library-reader-panel header h2 { margin: 0; overflow: hidden; color: var(--brand); font-size: 20px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.library-reader-panel header button { flex-shrink: 0; width: 38px; height: 38px; display: grid; place-items: center; color: var(--brand); background: var(--canvas); border: 0; border-radius: 50%; font-size: 20px; line-height: 1; }
.library-reader-body { padding: 24px; overflow-y: auto; }
.library-reader-body p { margin: 0 0 20px; color: rgba(27,67,50,.72); font-size: 16px; line-height: 32px; }
.library-reader-body p:last-child { margin-bottom: 0; }

.library-pdf-panel { width: min(900px,96vw); max-width: 900px; height: min(880px,92vh); max-height: 92vh; }
.library-pdf-toolbar-actions { display: flex; flex-shrink: 0; align-items: center; gap: 10px; }
.library-pdf-toolbar-actions a { flex-shrink: 0; color: var(--brand); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.library-pdf-body { flex: 1; min-height: 0; padding: 0; overflow: hidden; background: #4b5259; }
.library-pdf-body iframe { display: block; width: 100%; height: 100%; border: 0; }

.library-detail-body { display: grid; gap: 26px; }
.library-detail-body > section { scroll-margin-top: 96px; }
.library-detail-body h2,
.library-detail-body h3 { margin: 0 0 8px; color: var(--brand); font-weight: 700; }
.library-detail-body h2 { font-size: 24px; }
.library-detail-body h3 { font-size: 20px; }
.library-detail-body p { margin: 0; color: rgba(27,67,50,.66); font-size: 15px; line-height: 29px; }
.detail-quote { padding: 0 18px 0 0; border-right: 3px solid var(--accent); font-weight: 700; }
.detail-copy-row { display: flex; gap: 8px; }
.detail-copy-row button { min-height: 44px; padding: 9px 20px; color: var(--brand); background: var(--surface); border: 1px solid var(--brand); border-radius: 12px; }

.library-related { margin-top: 38px; padding-top: 28px; border-top: 1px solid rgba(27,67,50,.1); }
.library-related h2 { margin: 0 0 16px; font-size: 22px; }
.library-related > div { display: grid; gap: 12px; }
.library-related a { min-height: 62px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 14px 18px; color: var(--brand); border: 1px solid var(--line); border-radius: 14px; }
.library-related a:first-child { min-height: 100px; align-items: end; }
.library-related a strong { font-size: 15px; }
.library-related a span { color: rgba(27,67,50,.48); font-size: 11px; }

.library-lightbox { position: fixed; z-index: 1300; inset: 0; display: grid; place-items: center; padding: 40px; background: rgba(10,29,22,.86); }
.library-lightbox img { max-width: min(1100px,92vw); max-height: 88vh; object-fit: contain; border-radius: 18px; transition: transform .15s ease; }
.library-lightbox > button[data-close-lightbox] { position: fixed; top: 24px; left: 24px; width: 46px; height: 46px; color: var(--brand); background: var(--surface); border: 0; border-radius: 50%; font-size: 26px; }

/* Full-size image lightbox zoom controls (Task 2) — separate from the card-detail zoom controls */
.library-lightbox-zoom-controls { position: fixed; top: 24px; right: 24px; display: flex; align-items: center; gap: 10px; padding: 6px; background: var(--surface); border-radius: 999px; box-shadow: 0 12px 30px rgba(10,29,22,.3); }
.library-lightbox-zoom-controls button { width: 36px; height: 36px; display: grid; place-items: center; color: var(--brand); background: var(--canvas); border: 0; border-radius: 50%; font-size: 18px; line-height: 1; }
.library-lightbox-zoom-controls button:hover,
.library-lightbox-zoom-controls button:focus-visible { color: var(--surface); background: var(--brand); }
.library-lightbox-zoom-controls button:disabled { opacity: .4; cursor: not-allowed; }
.library-lightbox-zoom-controls span { min-width: 44px; color: var(--brand); font-size: 13px; font-weight: 700; text-align: center; }
.library-toast { position: fixed; z-index: 1500; bottom: 24px; left: 24px; max-width: min(420px,calc(100vw - 48px)); padding: 13px 18px; color: var(--surface); background: var(--brand); border-radius: 13px; box-shadow: 0 16px 44px rgba(17,50,37,.2); font-size: 14px; }

/* Published analysis */
.library-analysis-main { width: min(1040px,calc(100% - 64px)); display: grid; grid-template-columns: 260px minmax(0,1fr); grid-template-areas: "aside content"; gap: 24px; margin: 0 auto; padding: 48px 0 96px; direction: ltr; }
.analysis-contents-aside { grid-area: aside; position: sticky; top: 96px; align-self: start; display: grid; gap: 16px; direction: rtl; }
.analysis-contents-aside nav,
.analysis-contents-aside > div { display: grid; gap: 8px; padding: 22px; border: 1px solid rgba(27,67,50,.14); border-radius: 20px; }
.analysis-contents-aside strong { margin-bottom: 3px; color: rgba(27,67,50,.62); font-size: 13px; }
.analysis-contents-aside a { padding: 7px; color: var(--brand); font-size: 13px; }
.analysis-contents-aside button,
.analysis-contents-aside > div a { min-height: 42px; display: grid; place-items: center; color: var(--brand); background: var(--surface); border: 1px solid var(--brand); border-radius: 11px; font-size: 12px; }
.analysis-published-content { grid-area: content; min-width: 0; display: grid; gap: 38px; direction: rtl; text-align: right; }
.analysis-published-header > div { display: flex; flex-direction: row-reverse; justify-content: flex-start; align-items: center; gap: 8px; }
.analysis-published-header span { padding: 8px 16px; color: var(--accent); background: rgba(212,134,11,.14); border-radius: 999px; font-size: 12px; }
.analysis-published-header small { color: rgba(27,67,50,.48); }
.analysis-published-header h2 { margin: 14px 0 4px; font-size: 38px; line-height: 1.35; }
.analysis-published-header p { margin: 0; color: rgba(27,67,50,.58); font-size: 16px; }
.analysis-published-content section { scroll-margin-top: 96px; }
.analysis-published-content h3 { margin: 0 0 9px; font-size: 24px; }
.analysis-published-content p { margin: 0; color: var(--muted-brand); font-size: 15px; line-height: 29px; }
.analysis-summary-box { padding: 24px 30px; background: var(--canvas); border-radius: 20px; }
.analysis-summary-box span { display: block; margin-bottom: 6px; color: rgba(27,67,50,.5); font-size: 13px; font-weight: 700; }
.analysis-points { display: grid; gap: 14px; }
.analysis-points article { padding: 16px; border: 1px solid var(--line); border-radius: 14px; }
.analysis-points strong { display: block; margin-bottom: 4px; font-size: 14px; }
.analysis-source > div { display: flex; align-items: center; justify-content: space-between; }
.analysis-source button { color: var(--brand); background: transparent; border: 0; font-size: 12px; }
.analysis-source p { padding: 16px; background: var(--canvas); border-radius: 14px; }
.analysis-wording { padding: 24px; border: 1px solid var(--line); border-radius: 18px; }
.analysis-wording button { min-height: 44px; margin-top: 16px; padding: 8px 18px; color: var(--brand); background: var(--surface); border: 1px solid var(--brand); border-radius: 11px; }
.analysis-references { display: grid; gap: 12px; }
.analysis-references h3 { margin-bottom: 2px; }
.analysis-references a { min-height: 72px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 3px 16px; align-items: center; padding: 14px 18px; color: var(--brand); border: 1px solid var(--line); border-radius: 14px; }
.analysis-references a small { color: rgba(27,67,50,.45); }
.analysis-references a b { grid-column: 2; grid-row: 1 / span 2; text-decoration: underline; }
.analysis-references > p { font-size: 12px; }
.analysis-training-cta { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px; background: var(--canvas); border-radius: 18px; }
.analysis-training-cta div { display: grid; gap: 2px; }
.analysis-training-cta span { color: rgba(27,67,50,.5); font-size: 12px; }
.analysis-training-cta .btn { min-width: 150px; }
.analysis-review-note { padding: 22px; background: var(--canvas); border: 1px solid var(--line); border-radius: 18px; }
.analysis-review-note strong { display: block; margin-bottom: 5px; }

@media (max-width: 1199.98px) {
  .library-app,
  .sidebar-collapsed .library-app { width: 100%; margin-right: 0; }
  .library-header-title { margin-left: auto; }
  .library-index-main { width: calc(100% - 48px); }
  .library-index-hero { grid-template-columns: minmax(0,1fr) 330px; }
  .library-card-grid,
  .library-media-grid,
  .library-book-grid,
  .library-short-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .library-audio-list { grid-template-columns: 1fr; }
  .library-detail-main,
  .library-analysis-main { width: calc(100% - 40px); grid-template-columns: 250px minmax(0,1fr); }
  .detail-media-split,
  .detail-audio-layout { grid-template-columns: minmax(0,1fr) 220px; }
}

@media (max-width: 991.98px) {
  .library-header-actions { gap: 8px; }
  .library-language { min-width: 82px; height: 40px; padding-inline: 14px; font-size: 13px; }
  .library-back-link { display: none; }
  .library-index-main { width: calc(100% - 40px); padding-top: 40px; }
  .library-index-hero { grid-template-columns: 1fr; }
  .library-index-hero figure { order: -1; }
  .library-detail-main,
  .library-analysis-main { grid-template-columns: 1fr; grid-template-areas: "content" "aside"; }
  .library-content-aside,
  .analysis-contents-aside { position: static; }
  .detail-video-frame { height: 360px; }
  .library-reader-panel { max-height: 88vh; }
}

@media (max-width: 700px) {
  .library-header-title h1 { max-width: 170px; font-size: 17px; }
  .library-header-title p { display: none; }
  .library-avatar { display: none; }
  .library-index-hero h2 { font-size: 28px; }
  .library-index-hero p { font-size: 14px; line-height: 25px; }
  .library-type-filters button { padding-inline: 18px; }
  .library-card-grid,
  .library-media-grid,
  .library-book-grid,
  .library-short-grid { grid-template-columns: 1fr; }
  .library-featured-book { grid-template-columns: 1fr; }
  .library-featured-book figure { min-height: 220px; }
  .library-article-item { grid-template-columns: 110px minmax(0,1fr); gap: 14px; }
  .library-article-item img { width: 110px; height: 90px; }
  .library-no-results { padding: 28px 22px; }
  .library-no-results > div { flex-direction: column; }
  .library-detail-main,
  .library-analysis-main { width: calc(100% - 32px); padding-top: 28px; }
  .library-detail-tags { margin-bottom: 20px; }
  .detail-question-box { padding: 22px; }
  .detail-question-box h2 { font-size: 24px; line-height: 36px; }
  .detail-media-split,
  .detail-audio-layout,
  .detail-card-layout { grid-template-columns: 1fr; }
  .detail-audio-layout { direction: rtl; }
  .detail-media-image,
  .detail-audio-cover { order: -1; }
  .detail-video-frame { height: 250px; }
  .detail-media-split h2,
  .detail-audio-layout h2,
  .detail-video-copy h2 { font-size: 26px; }
  .detail-action-row { flex-wrap: wrap; }
  .library-lightbox { padding: 16px; }
  .analysis-published-header h2 { font-size: 30px; }
  .analysis-training-cta { align-items: stretch; flex-direction: column; }
  .library-reader-modal { padding: 0; }
  .library-reader-panel { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
  .detail-card-zoom-controls { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .library-app,
  .library-header,
  .detail-card-zoom-target { transition: none; }
}
