.lib-shell { position: fixed; inset: 0; background: var(--bg-1); color: var(--fg-1); font-family: var(--font-sans); overflow: hidden; }

.lib-top {
  position: fixed; left: 0; right: 0; top: 0; z-index: 10;
  min-height: 84px; padding: 18px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: color-mix(in oklch, var(--bg-1) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.lib-kicker { font-size: 11px; font-weight: 700; color: var(--fg-3); letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 4px; }
.lib-title { font-family: var(--font-serif); font-size: clamp(28px, 4vw, 44px); line-height: 1; letter-spacing: -0.03em; margin: 0; }
.lib-actions { display: inline-flex; align-items: center; gap: 14px; flex-shrink: 0; }
.lib-link { color: var(--fg-2); font-size: 13px; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.lib-link:hover { color: var(--fg-1); }

.lib-main { height: 100%; overflow-y: auto; padding-top: 84px; }
.lib-body { padding: 36px 28px 80px; }

.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 240px)); gap: 32px 24px; }

.cell { background: transparent; border: 0; padding: 0; text-align: left; cursor: pointer; display: flex; flex-direction: column; color: var(--fg-1); text-decoration: none; }
.cell__cover { aspect-ratio: 2/3; width: 100%; box-shadow: var(--shadow-2); position: relative; overflow: hidden; transition: transform var(--dur-base) var(--ease); border-radius: var(--radius-md); }
.cell:hover .cell__cover { transform: translateY(-2px); box-shadow: var(--shadow-3); }
.cell--disabled { cursor: default; color: var(--fg-3); }
.cell--disabled .cell__cover { filter: saturate(0.6); opacity: 0.72; box-shadow: var(--shadow-1); }
.cell--disabled:hover .cell__cover { transform: none; box-shadow: var(--shadow-1); }
.cell__cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.80) 0%, rgba(0,0,0,0.40) 40%, transparent 100%); pointer-events: none; z-index: 1; }
.cell__cover-caption { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 14px; z-index: 2; }
.cell__cover-tag { font-family: var(--font-sans); font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.65); text-transform: uppercase; letter-spacing: 0.10em; margin-bottom: 4px; }
.cell__cover-title { font-family: var(--font-serif); color: rgba(255,255,255,0.95); font-size: 15px; font-weight: 600; line-height: 1.2; letter-spacing: -0.005em; }
.cell__cover-author { font-family: var(--font-serif); color: rgba(255,255,255,0.65); font-size: 12px; font-style: italic; margin-top: 3px; }
.cell__meta { font-size: 13px; color: var(--fg-3); margin-top: 10px; }

.lib-empty { padding: 80px 0; text-align: center; color: var(--fg-3); font-family: var(--font-serif); font-style: italic; font-size: 17px; }
.lib-empty code { font-family: var(--font-sans); font-style: normal; }

@media (max-width: 620px) {
  .lib-top { align-items: flex-start; padding: 16px 18px; }
  .lib-actions { gap: 16px; padding-top: 4px; }
  .lib-link .icon { width: 22px; height: 22px; }
  .lib-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lib-body { padding: 28px 18px 64px; }
  .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
}
