:root {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  color: #292927;
  background: #f8f8f6;
  font-synthesis: none;
  --line: #e2e2dd;
  --muted: #777773;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a, select { touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #62625c; outline-offset: 4px; }
.collection { padding: 0 32px 32px; max-width: 1920px; margin: auto; }
.library-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 25px 0; }
.library-title { display: flex; align-items: baseline; gap: 10px; }
h1 { margin: 0; font-size: 18px; font-weight: 400; letter-spacing: -.2px; }
.result-count { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.library-tools { display: flex; align-items: center; gap: 10px; }
.search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--muted); }
.search:focus-within { border-color: #95958d; }
.search input { width: 216px; min-width: 0; border: 0; outline: none; background: transparent; color: inherit; font-size: 12px; }
kbd { padding: 0 4px; border: 1px solid var(--line); border-radius: 3px; font-size: 10px; line-height: 17px; }
select { max-width: 100%; height: 34px; border: 1px solid var(--line); border-radius: 7px; background: white; color: #595954; padding: 0 25px 0 10px; font-size: 12px; }
#topic { width: 135px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 20px; }
.lab-card { min-width: 0; }
.preview-wrap { position: relative; overflow: hidden; aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 10px; background: #eeeee9; isolation: isolate; content-visibility: auto; }
.preview-frame { position: absolute; top: 0; left: 0; width: 1200px; height: 900px; border: 0; transform-origin: top left; pointer-events: none; opacity: 0; }
.preview-wrap.ready .preview-frame { opacity: 1; }
.preview-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #93938b; font-size: 12px; }
.preview-fallback { width: 100%; height: 100%; object-fit: contain; }
.preview-wrap.ready .preview-placeholder { display: none; }
.preview-open { position: absolute; inset: 0; z-index: 1; }
.preview-open:focus-visible { outline-offset: -4px; border-radius: 10px; }
.preview-open::after { content: "↗"; position: absolute; right: 10px; bottom: 10px; width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid #d5d5ce; border-radius: 6px; background: #ffffffed; color: #4d4d47; opacity: 0; }
.preview-open:hover::after, .preview-open:focus-visible::after { opacity: 1; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 2px 7px; }
.card-identity { display: grid; justify-items: start; gap: 4px; min-width: 0; }
.author-link { max-width: 100%; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.author-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.card-link { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 400; }
.card-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.page-count { flex-shrink: 0; font-size: 11px; color: var(--muted); }
.round-select { height: 27px; width: 100%; font-size: 11px; color: var(--muted); border-color: transparent; background-color: transparent; padding-left: 1px; border-radius: 4px; }
.round-select:hover, .round-select:focus-visible { background: white; border-color: var(--line); }
.message { padding: 40px 0; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.viewer { height: 100dvh; display: flex; flex-direction: column; background: white; }
.viewer-toolbar { display: flex; align-items: center; gap: 14px; padding: 11px 16px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
#viewer-title { font-size: 13px; font-weight: 400; white-space: nowrap; }
.viewer-page { min-width: 0; }
#page-select { max-width: 350px; }
.viewer-actions { display: flex; gap: 8px; margin-left: auto; }
.quiet-button { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; border: 1px solid var(--line); border-radius: 6px; padding: 7px 11px; background: white; color: #52524c; font-size: 12px; white-space: nowrap; }
.quiet-button:hover { background: #f4f4ef; }
#prototype { display: block; width: 100%; flex: 1; min-height: 0; border: 0; background: white; }
.viewer-notice { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); padding: 10px 16px; border-radius: 7px; background: #33332e; color: white; font-size: 12px; max-width: calc(100% - 30px); z-index: 2; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (min-width: 1700px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1050px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .collection { padding: 0 24px 24px; } }
@media (max-width: 650px) {
  .collection { padding: 0 16px 24px; }
  .library-header { align-items: stretch; flex-direction: column; gap: 17px; padding: 20px 0; }
  .library-tools { gap: 8px; }
  .search { flex: 1; min-width: 0; }
  .search input { width: 100%; }
  kbd { display: none; }
  #topic { width: 112px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .viewer-toolbar { flex-wrap: wrap; gap: 8px; padding: 10px; }
  .viewer-page { order: 3; width: 100%; }
  #page-select { width: 100%; max-width: none; }
  #viewer-title { flex: 1; overflow: hidden; text-overflow: ellipsis; }
  .quiet-button { padding: 7px 9px; font-size: 11px; }
}
