/* The Library (/library): apps and parts in one feed. Part tiles (docs/design/parts-and-save-points.md §4): sprites animate and sounds play on a tap. Tokens from themes.css. */
.pt-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0; }
.pt-tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); }
.pt-tabs button { font: 600 14px var(--font-ui, inherit); color: var(--text-muted); background: transparent; border: 0; border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer; }
.pt-tabs button[aria-selected="true"] { background: var(--bg); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.pt-sort { color: var(--text-muted); font-size: 14px; display: inline-flex; gap: 8px; align-items: center; }
.pt-sort select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); min-height: 40px; padding: 0 8px; }
.pt-status { color: var(--text-muted); min-height: 1.4em; }
.pt-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 720px) { .pt-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.pt-tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 10px; background: var(--surface); border-radius: var(--r-lg, 14px); scroll-margin-top: 80px; }
.pt-tile:target { box-shadow: 0 0 0 2px var(--accent); }
.pt-art { display: grid; place-items: center; aspect-ratio: 1; border-radius: var(--r-sm); background: var(--lcd); color: var(--lcd-ink); overflow: hidden; }
.pt-art canvas { width: 70%; height: 70%; object-fit: contain; image-rendering: pixelated; }
.pt-art .pt-wave { display: flex; align-items: center; gap: 2px; width: 80%; height: 45%; }
.pt-art .pt-wave i { flex: 1; background: var(--lcd-ink); border-radius: 1px; opacity: .75; }
.pt-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-by { color: var(--text-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pt-acts button, .pt-acts a { font: 600 14px var(--font-ui, inherit); min-height: 40px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: var(--btn); color: var(--text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.pt-acts .pt-use { background: var(--accent); color: var(--accent-ink); }
.pt-acts .pt-menu { padding: 0 10px; background: transparent; color: var(--text-muted); }
.pt-acts button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.pt-sub { margin: 40px 0 12px; font-family: var(--font-display); font-size: 22px; }
.pt-more { margin: 16px auto 0; display: block; position: absolute; left: 50%; translate: -50% 0; opacity: 0; pointer-events: none; font: 600 14px var(--font-ui, inherit); min-height: 40px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--btn); color: var(--text); cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .pt-tile * { transition: none !important; } }
.lib-page { padding-block: 24px 48px; }
.lib-page .sec-head p { max-width: 62ch; }
.lib-learn { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 14px 16px; border-radius: var(--r-lg, 14px); background: var(--surface); color: var(--text); text-decoration: none; box-shadow: inset 0 0 0 1px var(--line); }
.lib-learn:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.lib-learn-k { font-weight: 700; color: var(--accent); }
.lib-apps[hidden] { display: none; }
.lib-band { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px; padding-block: 4px; }
.lib-band-h { margin: 0; font-family: var(--font-display); font-size: 20px; }
.pt-acts .pt-star { margin-left: auto; padding: 0 10px; background: transparent; color: var(--text-muted); font-size: 18px; }
.pt-acts .pt-star[aria-pressed="true"] { color: var(--accent); background: transparent; }
.lib-help { margin-top: 24px; }
.lib-end { margin: 40px 0 8px; text-align: center; font-family: var(--font-lcd); font-size: clamp(48px, 12vw, 88px); line-height: 1; color: var(--text-muted); letter-spacing: 2px; }
.lib-end[hidden] { display: none; }
/* The endless feed's tail: two rows of ghost tiles with a shimmer; the next page loads when they come into view. */
.lib-ghosts { position: relative; margin-top: 12px; }
.lib-ghosts[hidden] { display: none; }
.lib-ghosts li { aspect-ratio: 5 / 8; border-radius: var(--r-lg, 14px); background: linear-gradient(100deg, var(--surface) 30%, color-mix(in srgb, var(--text) 10%, var(--surface)) 50%, var(--surface) 70%) 0 0 / 300% 100%; animation: lib-shimmer 1.4s linear infinite; }
@media (max-width: 719.98px) { .lib-ghosts li:nth-child(n + 5) { display: none; } } /* two rows of the grid above: 2 a row on a phone, 4 wider */
@keyframes lib-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .lib-ghosts li { animation: none; background: var(--surface); } }
.pt-more:focus-visible, .lib-ghosts-tap .pt-more { opacity: 1; pointer-events: auto; position: static; translate: none; }
/* The Printable models shelf (CADR-0196; tiles in model.css). */
.lib-models-all { display: flex; flex-direction: column; gap: 12px; }
.lib-models-all[hidden] { display: none; }
.lib-band-more { align-self: flex-start; font-weight: 600; }
/* The filter chips: one row you swipe sideways (no scrollbar), held at the top once you scroll past (captain, 2026-11-27). */
.lib-page #lib-filter { position: sticky; top: 0; z-index: 40; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; margin-inline: calc(-1 * var(--gutter, 16px)); padding: 8px var(--gutter, 16px); background: var(--bg); }
.lib-page #lib-filter::-webkit-scrollbar { display: none; }
.lib-page #lib-filter .try-pill { flex: none; }
/* Native code (CADR-0203, TB-15): a Rust module's tile spans two columns, for its functions and builds. */
.lib-native { display: grid; gap: 8px; }
.lib-native[hidden] { display: none; }
.pt-native { grid-column: span 2; }
.pt-native-art { aspect-ratio: 3 / 1; }
.pt-native-art svg { width: 40%; height: 70%; }
.pt-blurb { font-size: 14px; }
.pt-ns { font: 13px var(--font-mono), ui-monospace, monospace; color: var(--text-muted); overflow-wrap: anywhere; }
.pt-fns { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; font-size: 13px; }
.pt-fns code { font-family: var(--font-mono), ui-monospace, monospace; }
.pt-builds { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--text-muted); }
.pt-builds a { color: var(--text); }
@media (max-width: 520px) { .pt-native { grid-column: 1 / -1; } }
