/* ============================================================
   AURA — Library (Your Generations gallery + detail viewer)
   ============================================================ */
.lib {
  flex: 1 1 auto;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 30px 40px 64px;
}
.lib::-webkit-scrollbar { width: 10px; }
.lib::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 3px solid var(--bg); }

/* header + tabs */
.lib-head { margin-bottom: 22px; }
.lib-head h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}
.lib-tabs {
  display: flex;
  gap: 26px;
  border-bottom: 1px solid var(--line);
}
.lib-tab {
  position: relative;
  background: transparent;
  border: 0;
  color: var(--text-3);
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  padding: 0 0 14px;
  cursor: pointer;
  transition: color .15s;
}
.lib-tab:hover { color: var(--text-2); }
.lib-tab.active { color: var(--text); }
.lib-tab.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
}

/* toolbar */
.lib-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  box-shadow: 0 12px 32px -22px rgba(0,0,0,.65);
}
.lib-search {
  flex: 1 1 280px;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0 14px;
  height: 44px;
}
.lib-search svg { width: 18px; height: 18px; color: var(--text-3); flex: 0 0 auto; }
.lib-search input {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: 0; outline: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
}
.lib-search input::placeholder { color: var(--text-3); }
.lib-search-btn {
  height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 10px 26px -10px var(--accent-ring);
  transition: filter .15s, transform .1s, box-shadow .2s;
}
.lib-search-btn:hover { filter: brightness(1.08); box-shadow: 0 14px 32px -10px var(--accent-ring); }
.lib-search-btn:active { transform: scale(.97); }

.lib-seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 4px;
  gap: 2px;
}
.lib-seg button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 15px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-weight: 700;
  font-size: 13.5px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.lib-seg button svg { width: 16px; height: 16px; }
.lib-seg button:hover { color: var(--text); }
.lib-seg button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 8px -3px rgba(0,0,0,.4);
}
.lib-seg button.active svg { color: var(--accent-2); }
.lib-count { margin-left: auto; color: var(--text-3); font-size: 13px; font-weight: 600; padding-right: 6px; white-space: nowrap; }

/* grid — strict uniform 300×300 tiles */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 300px);
  gap: 18px;
  justify-content: center;
}
.lib-card {
  width: 300px;
}
.lib-thumb {
  position: relative;
  width: 300px;
  height: 300px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: pointer;
  background: var(--surface);
  box-shadow: 0 6px 18px -10px rgba(0,0,0,.55);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.lib-thumb image-slot { width: 100%; height: 100%; display: block; }
.lib-card:hover .lib-thumb { border-color: var(--accent-ring); transform: translateY(-3px); box-shadow: 0 24px 46px -24px rgba(0,0,0,.72), 0 10px 30px -14px var(--accent-ring); }

.lib-type {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: 8px;
  background: rgba(12,12,16,.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.lib-type svg { width: 13px; height: 13px; }
.lib-fav {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 3;
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(12,12,16,.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .15s, color .15s, transform .1s;
}
.lib-fav:hover { background: rgba(12,12,16,.85); }
.lib-fav:active { transform: scale(.9); }
.lib-fav svg { width: 18px; height: 18px; transition: fill .15s; }
.lib-fav.on { color: #f5c542; border-color: rgba(245,197,66,.55); }
.lib-fav.on svg { fill: #f5c542; }

.lib-play {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid; place-items: center;
  pointer-events: none;
}
.lib-play span {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: rgba(12,12,16,.5);
  border: 1.5px solid rgba(255,255,255,.5);
  display: grid; place-items: center;
}
.lib-play svg { width: 22px; height: 22px; color: #fff; }

/* Панель действий на карточке (повторить / оживить / скачать) — всегда видима (тап на мобилке) */
.lib-acts {
  position: absolute;
  left: 10px; right: 10px; bottom: 10px;
  z-index: 4;
  display: flex; gap: 6px; justify-content: flex-end;
  pointer-events: none;
}
.lib-act {
  pointer-events: auto;
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(12,12,16,.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.lib-act:hover { background: rgba(12,12,16,.85); }
.lib-act:active { transform: scale(.9); }
.lib-act svg { width: 17px; height: 17px; }

.lib-hover {
  position: absolute;
  inset: 0;
  z-index: 4;
  opacity: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px;
  background: linear-gradient(to top, rgba(8,8,12,.82) 0%, rgba(8,8,12,.15) 55%, transparent 100%);
  transition: opacity .16s;
}
.lib-thumb:hover .lib-hover { opacity: 1; }
.lib-hover .lh-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  border: 0;
  border-radius: 11px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: filter .15s, background .15s, transform .08s;
}
.lib-hover .lh-btn:active { transform: scale(.98); }
.lib-hover .lh-btn svg { width: 16px; height: 16px; }
.lib-hover .lh-btn.primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 8px 22px -10px var(--accent-ring);
}
.lib-hover .lh-btn.primary:hover { filter: brightness(1.08); }
.lib-hover .lh-btn.ghost {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.lib-hover .lh-btn.ghost:hover { background: rgba(255,255,255,.2); }

.lib-empty {
  text-align: center;
  color: var(--text-3);
  font-size: 15px;
  padding: 80px 0;
}

/* ============================================================
   DETAIL VIEWER
   ============================================================ */
.lib-viewer {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(6,6,9,.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.lib-viewer.open { opacity: 1; pointer-events: auto; }
:root[data-theme="light"] .lib-viewer { background: rgba(20,20,28,.7); }

.lv-inner {
  display: flex;
  gap: 22px;
  width: 100%;
  height: 100%;
  padding: 26px 28px;
}
.lv-thumbs {
  flex: 0 0 86px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-top: 4px;
}
.lv-thumb {
  width: 86px; height: 86px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  flex: 0 0 auto;
  background: var(--surface);
}
.lv-thumb.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lv-thumb image-slot { width: 100%; height: 100%; }

.lv-stage {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  min-width: 0;
  position: relative;
}
.lv-result {
  position: relative;
  width: min(64vh, 100%);
  aspect-ratio: var(--ar, 1 / 1);
  max-height: calc(100vh - 64px);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: 0 50px 110px -34px rgba(0,0,0,.78);
}
.lv-result image-slot { width: 100%; height: 100%; }
.lv-like {
  position: absolute;
  top: 16px; right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 99px;
  background: rgba(12,12,16,.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.16);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.lv-like svg { width: 19px; height: 19px; }
.lv-like.liked { color: #f5c542; }
.lv-like.liked svg { fill: #f5c542; stroke: #f5c542; }

/* ===== группа кнопок вьюера внутри панели, над профилем: Сохранить + Избранное + Закрыть ===== */
.lv-corner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
/* избранное — только значок; крестик уезжает в правый край строки */
.lv-corner .lv-like { position: static; top: auto; right: auto; width: 40px; padding: 0; justify-content: center; gap: 0; }
.lv-corner .lv-like span { display: none; }
.lv-corner .lv-close {
  position: static; top: auto; right: auto;
  margin-left: auto;
  width: 40px; height: 40px;
  border-radius: 99px;
  background: rgba(12,12,16,.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.16);
  color: #fff;
}
.lv-corner .lv-close:hover { background: rgba(30,30,40,.72); color: #fff; }
.lv-corner .lv-close svg { width: 18px; height: 18px; }

/* «Сохранить результат» — выделенная кнопка, раскрывается в подпись и плавно сворачивается */
.lv-save {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 13px;
  border-radius: 99px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent, #7c5cff), var(--accent-2, #b69bff));
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  box-shadow: 0 8px 22px -10px var(--accent-ring, rgba(124,92,255,.7));
  transition: box-shadow .2s ease, transform .12s ease;
}
.lv-save:hover { box-shadow: 0 10px 26px -10px var(--accent-ring, rgba(124,92,255,.9)); }
.lv-save:active { transform: scale(.95); }
.lv-save .lv-save-ico { display: inline-flex; flex: none; }
.lv-save svg { width: 19px; height: 19px; }
.lv-save.saved svg { fill: currentColor; }           /* закладка заполняется, когда сохранено */
.lv-save .lv-save-txt {
  max-width: 0;
  margin-left: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width .35s ease, margin-left .35s ease, opacity .28s ease;
}
.lv-save.open .lv-save-txt { max-width: 220px; margin-left: 8px; opacity: 1; }

/* right info panel */
.lv-panel {
  flex: 0 0 384px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  padding: 22px 22px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px -42px rgba(0,0,0,.72);
}
.lv-panel::-webkit-scrollbar { width: 8px; }
.lv-panel::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }
/* children keep natural height; panel scrolls (prevents flex from collapsing the
   clamped prompt to 0, since overflow:hidden gives flex items min-height:0) */
.lv-panel > * { flex: 0 0 auto; }

.lv-close {
  position: absolute;
  top: 26px; right: 28px;
  z-index: 5;
}

.lv-author {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.lv-author .avatar { width: 42px; height: 42px; font-size: 16px; }
.lv-author .la-time { font-size: 12px; color: var(--text-3); font-weight: 600; }
.lv-author .la-name { font-weight: 800; font-size: 16px; }

.lv-prompt-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 12px;
}
.lv-prompt-head h3 { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin: 0; }
.lv-icobtn {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .14s, color .14s;
}
.lv-icobtn:hover { background: var(--surface-3); color: var(--text); }
.lv-icobtn svg { width: 16px; height: 16px; }
.lv-iterate {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit; font-weight: 700; font-size: 13px;
  cursor: pointer;
}
.lv-iterate:hover { border-color: var(--accent-ring); color: var(--accent-2); }
.lv-iterate svg { width: 15px; height: 15px; }

.lv-prompt {
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.6;
  margin: 0 0 16px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.lv-prompt.clamp {
  max-height: 6.6em;
  overflow: hidden;
}
.lv-more {
  background: transparent; border: 0;
  color: var(--accent-2); font-family: inherit; font-weight: 700; font-size: 13px;
  cursor: pointer; padding: 0; margin: -8px 0 16px;
}

.lv-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.lv-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 12.5px; font-weight: 700;
  padding: 7px 12px; border-radius: 9px;
}
.lv-chip svg { width: 14px; height: 14px; color: var(--accent-2); }

.lv-source { margin-bottom: 20px; }
.lv-source .ls-label { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 9px; }
.lv-source .ls-thumb {
  width: 84px; height: 84px;
  border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line);
}
.lv-source image-slot { width: 100%; height: 100%; }

.lv-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.lv-row2 { display: flex; gap: 10px; }
.lv-btn {
  flex: 1 1 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px;
  border: 0; border-radius: 12px;
  font-family: inherit; font-weight: 700; font-size: 14.5px;
  cursor: pointer;
  transition: filter .14s, background .14s, transform .08s;
}
.lv-btn:active { transform: scale(.98); }
.lv-btn svg { width: 17px; height: 17px; }
.lv-btn.primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; box-shadow: 0 12px 30px -10px var(--accent-ring); }
.lv-btn.primary:hover { filter: brightness(1.08); box-shadow: 0 16px 36px -10px var(--accent-ring); }
.lv-btn.ghost { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.lv-btn.ghost:hover { background: var(--surface-3); }
.lv-btn.video { background: var(--surface-2); border: 1px solid var(--accent-ring); color: var(--accent-2); }
.lv-btn.video:hover { background: var(--accent-soft); }

.lv-cost {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13.5px; color: var(--text-2); font-weight: 600;
}
.lv-cost .lc-val { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-weight: 800; }
.lv-cost .lc-val .coin { width: 18px; height: 18px; border-radius: 50%; flex: 0 0 auto; background: linear-gradient(160deg, #f0d97a, #c79a2e); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.35); }

/* ===== Шапка вьюера: профиль слева, избранное + крестик справа (одна строка) ===== */
.lv-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-bottom: 16px; margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.lv-head .lv-author { padding-bottom: 0; border-bottom: none; }
.lv-head-acts { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.lv-head-acts .lv-like {
  position: static; top: auto; right: auto;
  width: 40px; height: 40px; padding: 0; gap: 0; justify-content: center;
}
.lv-head-acts .lv-like span { display: none; }
.lv-head-acts .lv-close {
  position: static; margin: 0;
  width: 40px; height: 40px; border-radius: 99px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(12,12,16,.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.16);
  color: #fff; cursor: pointer;
}
.lv-head-acts .lv-close:hover { background: rgba(30,30,40,.72); }
.lv-head-acts .lv-close svg { width: 18px; height: 18px; }

/* ===== Нижний тумблер «Разместить на сайте» (во всю ширину панели) ===== */
.lv-publish {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.lv-publish .set-title { flex: 1 1 auto; }

/* ===== Тумблер + подсказка + заголовок (перенесено из studio.css — на странице Истории его нет) ===== */
.lv-panel .set-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--text); }
.lv-panel .set-title .q { width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid var(--text-3); color: var(--text-3); display: inline-grid; place-items: center; font-size: 10px; font-weight: 700; }
.lv-panel .tip { position: relative; display: inline-flex; align-items: center; }
.lv-panel .tip .q { cursor: help; }
.lv-panel .tip-pop {
  display: none; position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  width: 250px; background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 12px 14px; font-size: 12.5px; font-weight: 500; line-height: 1.5; color: var(--text-2);
  box-shadow: 0 18px 44px -14px rgba(0,0,0,.75); z-index: 80; white-space: normal; text-align: left;
}
.lv-panel .tip-pop::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--surface-3); }
.lv-panel .tip:hover .tip-pop, .lv-panel .tip:focus-within .tip-pop { display: block; }
.lv-panel .switch { position: relative; display: inline-flex; align-items: center; flex: 0 0 auto; }
.lv-panel .switch input { display: none; }
.lv-panel .switch .track { width: 50px; height: 28px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line); position: relative; cursor: pointer; transition: background .18s; display: flex; align-items: center; padding: 0 3px; }
.lv-panel .switch .knob { width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .18s; display: grid; place-items: center; }
.lv-panel .switch .knob svg { width: 13px; height: 13px; color: var(--accent); display: none; }
.lv-panel .switch input:checked + .track { background: var(--upgrade); }
.lv-panel .switch input:checked + .track .knob { transform: translateX(22px); }
.lv-panel .switch input:checked + .track .knob svg { display: block; color: #2a4d00; }

@media (max-width: 1080px) {
  .lv-panel { flex-basis: 320px; }
  .lv-thumbs { display: none; }
}
@media (max-width: 860px) {
  .lv-inner { flex-direction: column; padding: 16px; overflow-y: auto; }
  /* на мобилке: сначала шейп промпта (панель), ниже — результат (фото/видео) */
  .lv-panel { flex: 0 0 auto; order: 1; }
  .lv-stage { order: 2; }
  .lv-corner { gap: 8px; }
}

/* B1: звезда «В избранное» всегда кликабельна и поверх оверлея */
.lib-fav { z-index: 6; pointer-events: auto; }

/* п8: крестик удаления рядом со звездой (правее), прозрачный, при нажатии — цвет фона */
.lib-fav { right: 52px; }
.lib-del {
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid rgba(255,255,255,.18); background: transparent;
  color: #fff; cursor: pointer; z-index: 6;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.lib-del svg { width: 16px; height: 16px; }
.lib-del:active { background: var(--bg, #0a0a0f); border-color: var(--bg, #0a0a0f); color: var(--bg, #0a0a0f); }
.lv-actions > .lv-btn { flex: 0 0 auto; }

/* ── Вкладка «Фотосеты»: карточка-группа ── */
.lib-photoset { background: var(--surface-2, rgba(255,255,255,.03)); border: 1px solid var(--line); border-radius: 14px; padding: 12px; cursor: pointer; transition: border-color .2s; }
.lib-photoset:hover { border-color: var(--accent); }
.lib-ps-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.lib-ps-title { font-weight: 600; font-size: 14px; }
.lib-ps-count { font-size: 12px; color: var(--text-3); }
.lib-ps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lib-ps-grid img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; }
.lib-ps-empty { color: var(--text-3); font-size: 12px; padding: 20px; text-align: center; grid-column: 1 / -1; }

/* ── Модалка фотосета (галерея кадров) ── */
.lib-ps-modal { position: fixed; inset: 0; z-index: 200; background: rgba(6,6,9,.9); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.lib-ps-modal-inner { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; max-width: 760px; width: 100%; max-height: 88vh; overflow: hidden; display: flex; flex-direction: column; }
.lib-ps-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; }
.lib-ps-modal-x { background: none; border: none; color: var(--text-2); font-size: 26px; line-height: 1; cursor: pointer; }
.lib-ps-modal-x:hover { color: var(--text); }
.lib-ps-modal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 20px; overflow-y: auto; }
.lib-ps-modal-cell { position: relative; border-radius: 12px; overflow: hidden; }
.lib-ps-modal-cell img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
.lib-ps-dl { position: absolute; left: 8px; right: 8px; bottom: 8px; text-align: center; background: rgba(124,92,255,.9); color: #fff; padding: 7px; border-radius: 8px; font-size: 12px; font-weight: 600; text-decoration: none; opacity: 0; transition: opacity .2s; }
.lib-ps-modal-cell:hover .lib-ps-dl { opacity: 1; }

/* ── Действия на карточке фотосета ── */
.lib-ps-acts { display: flex; gap: 6px; }
.lib-ps-dlall, .lib-ps-x { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--text-2); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.lib-ps-dlall svg, .lib-ps-x svg { width: 15px; height: 15px; }
.lib-ps-dlall:hover { border-color: var(--accent); color: var(--accent-2); }
.lib-ps-x:hover { border-color: #ff7a7a; color: #ff7a7a; }

/* ── Модалка фотосета: слайдшоу ── */
.lib-ps-modal-acts { display: flex; align-items: center; gap: 12px; }
.lib-ps-modal-dlall { background: #ffffff; color: #111111; border: none; padding: 8px 16px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer; }
.lib-ps-modal-dlall:hover { background: var(--accent-2); }
.lib-ps-stage { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; background: #000; min-height: 0; padding: 16px; }
.lib-ps-big { max-width: 100%; max-height: 60vh; object-fit: contain; border-radius: 10px; }
.lib-ps-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; border: 1px solid rgba(255,255,255,.15); font-size: 24px; cursor: pointer; z-index: 2; }
.lib-ps-nav.l { left: 14px; } .lib-ps-nav.r { right: 14px; }
.lib-ps-nav:hover { background: rgba(0,0,0,.8); }
.lib-ps-dl-one { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); background: rgba(124,92,255,.92); color: #fff; border: none; padding: 9px 20px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.lib-ps-dl-one:hover { background: var(--accent-2); }
.lib-ps-thumbs { display: flex; gap: 8px; padding: 14px 20px; overflow-x: auto; border-top: 1px solid var(--line); }
.lib-ps-thumbs img { width: 56px; height: 74px; object-fit: cover; border-radius: 8px; cursor: pointer; opacity: .5; border: 2px solid transparent; flex-shrink: 0; transition: opacity .15s; }
.lib-ps-thumbs img.on, .lib-ps-thumbs img:hover { opacity: 1; border-color: var(--accent); }

/* ── Фотопрофили-двойники во вкладке «Клик» ── */
.lib-profiles { grid-column: 1 / -1; margin-bottom: 4px; }
.lib-profiles-head { font-family: var(--font-display, inherit); font-weight: 700; font-size: 15px; margin: 0 0 10px; color: var(--text, #fff); }
.lib-profiles-row { display: flex; flex-wrap: wrap; gap: 10px; }
.lib-prof {
  display: flex; align-items: center; gap: 11px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line, rgba(255,255,255,.08));
  border-radius: 14px; padding: 10px 12px; min-width: 232px;
}
.lib-prof.training { opacity: .72; }
.lib-prof-av {
  flex: none; width: 40px; height: 40px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: #ffffff; color: var(--accent-ink, #1a1f05);
  font-family: var(--font-display, inherit); font-weight: 700; font-size: 17px;
}
.lib-prof.training .lib-prof-av { background: rgba(255,255,255,.12); color: var(--text-2, #c7c7cf); }
.lib-prof-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.lib-prof-title { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 132px; }
.lib-prof-status { color: var(--text-3, #8a8a93); font-size: 11.5px; }
.lib-prof-acts { display: flex; align-items: center; gap: 6px; flex: none; }
.lib-prof-go {
  background: #ffffff; color: var(--accent-ink, #1a1f05);
  border: 0; border-radius: 9px; padding: 7px 11px;
  font-family: inherit; font-weight: 700; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.lib-prof-go:hover { filter: brightness(1.05); }
.lib-prof-ic {
  flex: none; width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.05); color: var(--text-2, #c7c7cf);
  border: 1px solid var(--line, rgba(255,255,255,.08)); cursor: pointer;
}
.lib-prof-ic:hover { background: rgba(255,255,255,.1); color: var(--text, #fff); }
.lib-prof-ic svg { width: 15px; height: 15px; }

/* ============================================================
   Аватар — выпадающий список фотопрофилей в фильтрах Истории
   ============================================================ */
#lib-seg { position: relative; }
.lib-av-caret { margin-left: 2px; opacity: .7; }
.lib-av-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  width: 300px; max-height: 380px; overflow-y: auto;
  background: var(--surface, #15151a); border: 1px solid var(--line, rgba(255,255,255,.1));
  border-radius: 14px; padding: 8px; box-shadow: 0 20px 50px -14px rgba(0,0,0,.7); }
.lib-av-new { display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: 10px;
  text-decoration: none; color: var(--text, #f4f4f6); font-weight: 600; font-size: 14px;
  border: 1px dashed var(--line-strong, rgba(255,255,255,.16)); margin-bottom: 8px; }
.lib-av-new:hover { background: rgba(255,255,255,.04); }
.lib-av-plus { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2, #1e1e24);
  display: grid; place-items: center; font-size: 20px; font-weight: 400; flex: none; }
.lib-av-list { display: flex; flex-direction: column; gap: 2px; }
.lib-av-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
  background: none; border: 0; cursor: pointer; text-align: left; width: 100%; color: var(--text, #f4f4f6); }
.lib-av-item:hover { background: rgba(255,255,255,.05); }
.lib-av-ava { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none;
  background: var(--surface-2, #1e1e24); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.lib-av-ava img { width: 100%; height: 100%; object-fit: cover; }
.lib-av-name { font-size: 14px; font-weight: 500; }
.lib-av-empty { padding: 18px 12px; text-align: center; color: var(--text-2, #a6a6b0); font-size: 13px; }

/* бейдж «мой» у собственных аватаров */
.lib-av-own { display: inline-block; margin-left: 8px; font-size: 10px; font-weight: 700; text-transform: uppercase;
  padding: 2px 6px; border-radius: 5px; background: #ffffff; color: #1a1f05; vertical-align: middle; }

/* страховка: [hidden] должен реально прятать меню аватаров */
.lib-av-menu[hidden] { display: none !important; }

/* ─────────────────────────────────────────────────────────────
   Исправления раздела «История»
   ───────────────────────────────────────────────────────────── */

/* В styles.css есть общее правило:
     .seg button.active { color: var(--accent-ink) !important; }
   Оно рассчитано на ЛАЙМОВЫЙ фон активного сегмента. Но у истории
   фон активного сегмента тёмный (--surface), и тёмный текст на нём
   сливался. Возвращаем светлый — специфичность выше, !important нужен,
   чтобы перебить правило выше. */
.lib-seg button.active { color: var(--text) !important; }
.lib-seg button.active svg { color: var(--accent-2) !important; }

/* Кегль на 1px меньше: «Аватар» упирался в правый край шейпа */
.lib-seg button { font-size: 12.5px; }

/* Кнопка «Найти» стоит на лаймовом градиенте — белый текст на нём терялся */
.lib-search-btn { color: #111111; }
