/* SpaceGram 3.1 package "library": every selector starts with the package prefix. */

.lib-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--input-bg, var(--surface-2));
  color: var(--text);
  font: inherit;
}
.lib-input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.lib-search-input { margin-bottom: 10px; }
.lib-note-input { min-height: 96px; resize: vertical; }
.lib-select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--input-bg, var(--surface-2));
  color: var(--text);
  font: inherit;
}

.lib-tabs {
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.lib-tabs::-webkit-scrollbar { display: none; }
.lib-tabs-scroll { margin-bottom: 10px; }
.lib-tab,
.lib-chip {
  flex: none;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2, var(--text));
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.lib-tab:hover,
.lib-chip:hover { background: var(--hover); }
.lib-tab.is-active,
.lib-chip.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.lib-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.lib-folder-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.lib-danger { color: var(--danger); }

.lib-gal-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.lib-gal-top .lib-tabs { flex: 1 1 260px; }

.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 4px;
}
.lib-tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-2);
  cursor: pointer;
}
.lib-tile img,
.lib-tile video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.lib-tile-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}
.lib-show {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  cursor: pointer;
}

.lib-list,
.lib-results { display: flex; flex-direction: column; }
.lib-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
}
.lib-hit { cursor: pointer; border-radius: 0; }
.lib-hit:hover { background: var(--hover); }
.lib-item.is-gone { opacity: 0.7; }
.lib-row { flex-direction: row; align-items: center; gap: 8px; }
.lib-row-main { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; }
.lib-item-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.lib-item-chat { min-width: 0; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.lib-item-at { flex: none; }
.lib-item-who { color: var(--accent); font-size: 13px; font-weight: 600; }
.lib-item-text {
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-item-note {
  padding: 6px 10px;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.lib-item-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.lib-muted { color: var(--muted); }
.lib-mark {
  padding: 0 1px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: inherit;
  font-weight: 650;
}
.lib-more { display: block; margin: 12px auto 0; }
.lib-audio { width: 100%; max-width: 360px; height: 36px; }
.lib-link-domain { color: var(--muted); font-size: 12px; }
.lib-link { color: var(--accent); overflow-wrap: anywhere; font-size: 14px; }

.lib-bm-mark {
  display: inline-flex;
  align-items: center;
  margin-right: 4px;
  color: var(--accent);
  vertical-align: -1px;
}

.lib-form { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 0; }
.lib-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
