/* Рабочая тема библиотеки Кабинета ГК */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f6f4fc;
  --ink: #2b2440;
  --muted: #6f6890;
  --primary: #6f55e0;
  --primary-dark: #5a44c9;
  --card: #ffffff;
  --line: #e4ddf5;
  --accent-bg: #efeafc;
  --dark: #171226;
  --stage-dark: #211b33;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(79, 60, 170, .10);
  --shadow-lg: 0 18px 48px rgba(79, 60, 170, .18);
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Segoe UI", "Nunito", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  line-height: 1.55;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(640px 420px at 12% -4%, rgba(111, 85, 224, .16), transparent 62%),
    radial-gradient(720px 520px at 96% 12%, rgba(236, 72, 153, .10), transparent 60%),
    radial-gradient(500px 400px at 60% 110%, rgba(56, 189, 248, .08), transparent 60%);
}
body > * { position: relative; z-index: 1; }
body.presenting { overflow: hidden; }

/* ---------- общие ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 15px;
  padding: 12px 20px; min-height: 46px;
  background: linear-gradient(135deg, var(--primary), #7c5cf0);
  color: #fff;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(111, 85, 224, .28);
}
.btn:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(111, 85, 224, .34); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn:focus-visible, .icon-btn:focus-visible, .hbtn:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 2px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--accent-bg); box-shadow: none; }
.btn.ghost.light { color: #fff; border-color: rgba(255,255,255,.25); }
.btn.ghost.light:hover { background: rgba(255,255,255,.1); }
.btn.danger { background: transparent; color: #d33f63; border: 1.5px solid #f3c6d1; box-shadow: none; }
.btn.danger:hover { background: #fdeef2; box-shadow: none; }
.btn.danger-solid { background: linear-gradient(135deg, #e0506f, #d33f63); color: #fff; box-shadow: 0 6px 18px rgba(211, 63, 99, .3); }
.btn.small { padding: 8px 14px; min-height: 38px; font-size: 13px; border-radius: 10px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 10px; border: 0; cursor: pointer;
  background: transparent; color: var(--muted); transition: background .15s ease, color .15s ease, transform .15s ease;
}
.icon-btn:hover { background: var(--accent-bg); color: var(--primary); transform: translateY(-1px); }
.icon-btn.danger:hover { background: #fdeef2; color: #d33f63; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}

/* ---------- библиотека ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 28px 16px 56px; }
.hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(120deg, #5b43d6, #7c5cf0 55%, #9a6cf5);
  border-radius: 24px; padding: 26px 28px; color: #fff;
  box-shadow: 0 20px 48px rgba(101, 74, 224, .38);
  animation: fadeUp .35s ease both;
}
.hero::after { content: ""; position: absolute; right: -70px; top: -70px; width: 230px; height: 230px; border-radius: 50%; background: rgba(255,255,255,.12); }
.hero::before { content: ""; position: absolute; right: 70px; bottom: -100px; width: 210px; height: 210px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero-mark {
  width: 58px; height: 58px; border-radius: 17px; flex-shrink: 0;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.hero-text { flex: 1; min-width: 240px; position: relative; z-index: 1; }
.hero h1 { font-size: clamp(20px, 3.4vw, 27px); letter-spacing: -.02em; }
.hero p { color: rgba(255,255,255,.85); font-size: 13px; max-width: 660px; margin-top: 4px; }
.hero .btn { background: #fff; color: var(--primary); flex-shrink: 0; position: relative; z-index: 1; }
.hero .btn:hover { background: #f3efff; }

.toolbar { display: flex; align-items: center; gap: 14px; margin: 20px 0 18px; flex-wrap: wrap; }
.search {
  flex: 1; min-width: 220px; max-width: 440px;
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px;
  color: var(--muted); transition: border-color .15s ease, box-shadow .15s ease;
}
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(111,85,224,.14); }
.search input { border: 0; outline: 0; flex: 1; font: inherit; font-size: 14px; padding: 11px 0; background: transparent; color: var(--ink); min-width: 0; }
.stats { margin-left: auto; font-size: 12.5px; color: var(--muted); font-weight: 700; white-space: nowrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  animation: fadeUp .35s ease both;
  display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card .cover {
  position: relative; display: block; aspect-ratio: 16/9; background: var(--accent-bg);
  overflow: hidden; cursor: pointer;
}
.card .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card .cover:hover img { transform: scale(1.05); }
.card .cover .play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(111, 85, 224, 0); transition: background .2s ease;
}
.card .cover:hover .play { background: rgba(111, 85, 224, .28); }
.card .cover .play span {
  width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.94);
  display: flex; align-items: center; justify-content: center; color: var(--primary);
  opacity: 0; transform: scale(.8); transition: all .2s ease;
  box-shadow: 0 8px 24px rgba(30,22,58,.3);
}
.card .cover:hover .play span { opacity: 1; transform: scale(1); }
.badge-count {
  position: absolute; right: 10px; bottom: 10px;
  background: rgba(20,14,40,.68); color: #fff; border-radius: 999px;
  font-size: 12px; font-weight: 700; padding: 3px 10px; backdrop-filter: blur(4px);
}
.badge-demo, .badge-fx {
  position: absolute; left: 10px; top: 10px;
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.94); color: var(--primary); border-radius: 999px;
  font-size: 11.5px; font-weight: 800; padding: 4px 10px;
}
.badge-fx { left: auto; right: 10px; top: 10px; color: #b45309; background: rgba(255, 247, 237, .95); }
.badge-demo + .badge-fx, .badge-fx ~ .badge-fx { top: 38px; }
.badge-fx .icon { width: 13px; height: 13px; }
.card .body { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { font-size: 15px; line-height: 1.35; }
.card .desc { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .foot {
  margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 8px 4px; border-top: 1px solid var(--line);
}
.foot-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.onlyview { font-size: 11.5px; color: #178a55; font-weight: 700; display: flex; align-items: center; gap: 5px; }
.onlyview .icon { width: 13px; height: 13px; }
.date { font-size: 11px; color: var(--muted); }
.empty {
  text-align: center; padding: 64px 20px; border: 2px dashed var(--line); border-radius: var(--radius);
  background: rgba(255,255,255,.55); display: flex; flex-direction: column; align-items: center; gap: 14px;
  grid-column: 1 / -1;
}
.empty .big { width: 72px; height: 72px; border-radius: 20px; background: var(--accent-bg); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.empty h2 { font-size: 19px; }
.empty p { color: var(--muted); font-size: 13.5px; max-width: 380px; }

/* ---------- модальные окна ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(30,22,58,.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100;
  animation: fadeIn .18s ease;
}
.modal {
  background: #fff; border-radius: 20px; width: 100%; max-width: 480px;
  max-height: 90dvh; overflow-y: auto; padding: 24px;
  animation: fadeUp .22s ease; box-shadow: 0 24px 64px rgba(30,22,58,.35);
}
.modal h2 { font-size: 19px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.modal .sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.field input[type="text"], .field textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px;
  font: inherit; font-size: 14px; background: #fbfaff; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(111,85,224,.14); }
.drop {
  border: 2px dashed var(--line); border-radius: 12px; background: #fbfaff;
  padding: 22px; text-align: center; cursor: pointer; color: var(--muted);
  transition: border-color .15s ease, background .15s ease; width: 100%; font: inherit;
}
.drop:hover, .drop.over { border-color: var(--primary); background: var(--accent-bg); }
.drop .name { font-weight: 800; color: var(--ink); font-size: 14px; }
.modal .row { display: flex; gap: 10px; }
.modal .row .btn { flex: 1; }
.err { color: #d33f63; font-size: 13px; margin: 8px 0; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* подсказка клавиш */
.keys { display: flex; flex-direction: column; gap: 8px; }
.key-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.key-row .key {
  background: var(--accent-bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 10px; font-weight: 700; font-size: 12px; color: var(--ink); white-space: nowrap;
}

/* ссылки */
.share-item {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
  animation: fadeUp .2s ease;
}
.share-item .info { flex: 1; min-width: 0; }
.share-item .tok { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-item .state { font-size: 12px; font-weight: 800; margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.share-item .state.ok { color: #178a55; }
.share-item .state.off { color: #d33f63; }

/* ---------- тосты ---------- */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1d1830; color: #fff; border-radius: 12px; padding: 11px 18px;
  font-size: 13.5px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.3);
  animation: fadeUp .2s ease; display: flex; gap: 8px; align-items: center; max-width: 90vw;
}
.toast.ok::before { content: "✓"; color: #5be49b; font-weight: 900; }
.toast.err::before { content: "!"; color: #ff7a9c; font-weight: 900; }

/* ---------- просмотрщик ---------- */
.viewer {
  position: fixed; inset: 0; background: radial-gradient(1200px 700px at 50% -10%, #2c2347, var(--dark) 60%);
  color: #fff;
  display: flex; flex-direction: column; user-select: none; -webkit-user-select: none; z-index: 50;
  animation: fadeIn .2s ease;
}
.viewer header {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; flex-shrink: 0;
  transition: opacity .3s ease, transform .3s ease;
}
.viewer header .ttl { min-width: 0; flex: 1; }
.viewer header h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer header .meta { font-size: 11.5px; color: rgba(255,255,255,.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill {
  background: rgba(255,255,255,.1); border-radius: 999px; padding: 5px 12px;
  font-size: 12px; font-weight: 800; color: #d9ccff; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.hbtn {
  width: 42px; height: 42px; border-radius: 11px; border: 0; cursor: pointer; flex-shrink: 0;
  background: rgba(255,255,255,.1); color: #fff; display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, transform .15s ease;
}
.hbtn:hover { background: rgba(255,255,255,.2); transform: translateY(-1px); }
.hbtn.on { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.3); }
.progress { height: 4px; margin: 0 16px; background: rgba(255,255,255,.1); border-radius: 99px; overflow: hidden; flex-shrink: 0; transition: opacity .3s ease; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #a78bfa, #7c5cf0); border-radius: 99px; transition: width .25s ease; }
.stage {
  position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 10px 8px; overflow: hidden;
}
.stage img.slide {
  max-width: 100%; max-height: 100%; border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
  pointer-events: none; -webkit-user-drag: none;
  transition: transform .3s cubic-bezier(.3,.7,.3,1), opacity .3s ease;
}
.stage canvas.slide {
  max-width: 100%; max-height: 100%; border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
  pointer-events: none; transition: opacity .2s ease;
}
.stage img.slide.enter-r { transform: translateX(70px); opacity: 0; }
.stage img.slide.enter-l { transform: translateX(-70px); opacity: 0; }

/* автоскрытие панелей в полном экране */
.viewer.idle header { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.viewer.idle .progress { opacity: 0; }
.viewer.idle .thumbs { opacity: 0; transform: translateY(8px); pointer-events: none; }
.viewer.idle .vfoot { opacity: 0; transform: translateY(8px); pointer-events: none; }
.viewer.idle .arrow { opacity: 0; pointer-events: none; }
.viewer header, .viewer .thumbs, .viewer .vfoot, .viewer .arrow { will-change: opacity, transform; }
.viewer .thumbs, .viewer .vfoot { transition: opacity .3s ease, transform .3s ease; }
.viewer .arrow { transition: opacity .3s ease, background .15s ease, transform .15s ease; }

/* лазерная указка */
.stage.laser { cursor: none; }
.laser-dot {
  position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border-radius: 50%; pointer-events: none; z-index: 20;
  background: radial-gradient(circle, rgba(255,255,255,.95) 0 18%, rgba(255,59,59,.9) 32%, rgba(255,59,59,.25) 58%, transparent 72%);
  box-shadow: 0 0 16px 6px rgba(255,59,59,.45);
  animation: fadeIn .12s ease;
}

/* обзор слайдов */
.overview {
  position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column;
  background: rgba(16, 10, 32, .93); backdrop-filter: blur(10px);
  padding: 18px; animation: fadeIn .18s ease;
}
.ov-head { display: flex; justify-content: space-between; align-items: center; color: #fff; font-weight: 800; margin-bottom: 14px; flex-shrink: 0; }
.ov-head .icon { width: 18px; height: 18px; vertical-align: -4px; margin-right: 6px; }
.ov-hint { font-weight: 500; font-size: 12px; color: rgba(255,255,255,.5); }
.ov-grid { overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; padding: 4px; align-content: start; }
.ov-cell {
  position: relative; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden;
  border: 2px solid rgba(255,255,255,.12); background: var(--stage-dark);
  cursor: pointer; padding: 0; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  color: rgba(255,255,255,.35); font-size: 20px;
}
.ov-cell img, .ov-cell canvas { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.ov-cell:hover { transform: scale(1.03); border-color: rgba(255,255,255,.45); }
.ov-cell.on { border-color: #a78bfa; box-shadow: 0 0 0 3px rgba(167,139,250,.35); }
.ov-num {
  position: absolute; left: 6px; top: 6px; z-index: 2;
  background: rgba(10,6,24,.72); color: #fff; font-size: 11px; font-weight: 800;
  border-radius: 6px; padding: 1px 7px; font-variant-numeric: tabular-nums;
}

/* ---------- DOM-сцена (режим deck) ---------- */
#px-slot {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}
.px-stage {
  position: relative; overflow: hidden;
  border-radius: 10px; box-shadow: 0 24px 70px rgba(0,0,0,.6);
  background: #fff;
}
#px-slot .px-stage { position: absolute; inset: 0; margin: auto; }
.pel { position: absolute; box-sizing: border-box; }
.pel-pic { background-repeat: no-repeat; }
.pel-hide { display: none !important; }
.pel .ptxt {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  overflow: hidden; box-sizing: border-box;
}
.pel .par { width: 100%; }
.pel .par span { white-space: pre-wrap; }

/* переходы между слайдами */
@keyframes pxFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pxFadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes pxPushInR { from { transform: translateX(100%); } to { transform: none; } }
@keyframes pxPushInL { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes pxPushOutR { from { transform: none; } to { transform: translateX(-100%); opacity: .4; } }
@keyframes pxPushOutL { from { transform: none; } to { transform: translateX(100%); opacity: .4; } }
@keyframes pxWipeInR { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
@keyframes pxWipeInL { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

#px-slot .px-stage.px-in-1-fade { animation: pxFadeIn .45s ease both; }
#px-slot .px-stage.px-in-1-push { animation: pxPushInR .5s cubic-bezier(.3,.7,.3,1) both; }
#px-slot .px-stage.px-in-1-wipe { animation: pxWipeInR .5s ease both; }
#px-slot .px-stage.px-in--1-fade { animation: pxFadeIn .45s ease both; }
#px-slot .px-stage.px-in--1-push { animation: pxPushInL .5s cubic-bezier(.3,.7,.3,1) both; }
#px-slot .px-stage.px-in--1-wipe { animation: pxWipeInL .5s ease both; }
#px-slot .px-stage.px-out-1-fade { animation: pxFadeOut .45s ease both; }
#px-slot .px-stage.px-out-1-push { animation: pxPushOutR .5s cubic-bezier(.3,.7,.3,1) both; }
#px-slot .px-stage.px-out--1-fade { animation: pxFadeOut .45s ease both; }
#px-slot .px-stage.px-out--1-push { animation: pxPushOutL .5s cubic-bezier(.3,.7,.3,1) both; }
#px-slot .px-stage.px-out-1-wipe, #px-slot .px-stage.px-out--1-wipe { animation: pxFadeOut .5s ease both; }

/* эффекты появления/исчезновения элементов */
@keyframes fxFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fxFadeOut { to { opacity: 0; } }
@keyframes fxFlyUpIn { from { transform: translateY(115%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fxFlyDownIn { from { transform: translateY(-115%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fxFlyRightIn { from { transform: translateX(-115%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fxFlyLeftIn { from { transform: translateX(115%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fxFlyUpOut { to { transform: translateY(-115%); opacity: 0; } }
@keyframes fxFlyDownOut { to { transform: translateY(115%); opacity: 0; } }
@keyframes fxFlyRightOut { to { transform: translateX(115%); opacity: 0; } }
@keyframes fxFlyLeftOut { to { transform: translateX(-115%); opacity: 0; } }
@keyframes fxWipeRightIn { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes fxWipeLeftIn { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
@keyframes fxWipeUpIn { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes fxWipeDownIn { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes fxWipeOut { to { clip-path: inset(0 0 0 100%); opacity: .15; } }
@keyframes fxZoomIn { from { transform: scale(.25); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fxZoomOut { to { transform: scale(.2); opacity: 0; } }

.pel.fx-fade-in { animation: fxFadeIn .45s ease both; }
.pel.fx-fade-out { animation: fxFadeOut .35s ease both; }
.pel.fx-fly-up-in { animation: fxFlyUpIn .55s cubic-bezier(.2,.7,.3,1) both; }
.pel.fx-fly-down-in { animation: fxFlyDownIn .55s cubic-bezier(.2,.7,.3,1) both; }
.pel.fx-fly-right-in { animation: fxFlyRightIn .55s cubic-bezier(.2,.7,.3,1) both; }
.pel.fx-fly-left-in { animation: fxFlyLeftIn .55s cubic-bezier(.2,.7,.3,1) both; }
.pel.fx-fly-up-out { animation: fxFlyUpOut .4s ease-in both; }
.pel.fx-fly-down-out { animation: fxFlyDownOut .4s ease-in both; }
.pel.fx-fly-right-out { animation: fxFlyRightOut .4s ease-in both; }
.pel.fx-fly-left-out { animation: fxFlyLeftOut .4s ease-in both; }
.pel.fx-wipe-right-in { animation: fxWipeRightIn .5s ease both; }
.pel.fx-wipe-left-in { animation: fxWipeLeftIn .5s ease both; }
.pel.fx-wipe-up-in { animation: fxWipeUpIn .5s ease both; }
.pel.fx-wipe-down-in { animation: fxWipeDownIn .5s ease both; }
.pel.fx-wipe-out { animation: fxWipeOut .35s ease both; }
.pel.fx-zoom-in { animation: fxZoomIn .45s cubic-bezier(.2,.7,.3,1) both; }
.pel.fx-zoom-out { animation: fxZoomOut .35s ease-in both; }

.watermark {
  position: absolute; inset: -40px; pointer-events: none; z-index: 5;
  display: flex; flex-wrap: wrap; align-content: space-around; justify-content: space-around;
  gap: 3rem 1rem; opacity: .13; transform: rotate(-18deg) scale(1.3);
  overflow: hidden;
}
.watermark span { font-size: 13px; font-weight: 800; white-space: nowrap; letter-spacing: .04em; }
.arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 10;
  width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.arrow:hover { background: rgba(255,255,255,.26); transform: translateY(-50%) scale(1.07); }
.arrow:disabled { opacity: .25; cursor: default; transform: translateY(-50%); }
.arrow.left { left: 16px; } .arrow.right { right: 16px; }
.thumbs { flex-shrink: 0; padding: 8px 14px 4px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; transition: opacity .3s ease, transform .3s ease; }
.thumbs .in { display: flex; gap: 8px; }
.thumbs button {
  flex-shrink: 0; width: 88px; height: 52px; border-radius: 8px; overflow: hidden;
  border: 2px solid transparent; padding: 0; cursor: pointer; opacity: .5;
  transition: opacity .15s ease, border-color .15s ease, transform .15s ease; background: #14101f;
}
.thumbs button.on { border-color: #a78bfa; opacity: 1; transform: translateY(-2px); }
.thumbs button:hover { opacity: .9; }
.thumbs button img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.thumbs button canvas.th-cnv { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.thumbs button.th-empty { background: #2a2440; }
.vfoot {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 14px 14px; transition: opacity .3s ease, transform .3s ease;
}
.vfoot .note { font-size: 11px; color: rgba(255,255,255,.4); text-align: center; flex: 1; }
.vfoot .hbtn { width: 38px; height: 38px; }
.mnav { display: flex; gap: 10px; }
.mnav .btn { padding: 10px 16px; min-height: 44px; }
.mnav .btn.ghost { color: #fff; border-color: rgba(255,255,255,.2); }
.mnav .btn.ghost:hover { background: rgba(255,255,255,.08); }
@media (min-width: 768px) {
  .arrow { display: flex; }
  .mnav { display: none; }
}
@media (max-width: 767px) {
  .vfoot .note { display: none; }
  .expiry-chip { bottom: 76px; max-width: 92vw; white-space: normal; text-align: center; }
  .hero { padding: 20px; }
  .stats { display: none; }
}
@media print {
  .viewer, .viewer * { display: none !important; visibility: hidden !important; }
}

/* плашка о сроке */
.expiry-chip {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: rgba(10,6,24,.78); backdrop-filter: blur(6px); color: #fff;
  border-radius: 999px; padding: 8px 16px; font-size: 12px; font-weight: 700;
  display: flex; gap: 8px; align-items: center; white-space: nowrap;
  animation: fadeUp .3s .3s ease both;
  border: 1px solid rgba(255,255,255,.08);
}
.expiry-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #5be49b; box-shadow: 0 0 8px #5be49b; }

/* экран ошибки ссылки */
.gone {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1000px 600px at 50% -10%, #2c2347, var(--dark) 60%);
  color: #fff; padding: 20px;
}
.gone .box {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 22px; padding: 34px;
  max-width: 420px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px;
  animation: fadeUp .3s ease; backdrop-filter: blur(6px);
}
.gone .ico {
  width: 64px; height: 64px; border-radius: 18px; background: rgba(167,139,250,.15);
  display: flex; align-items: center; justify-content: center; color: #c4b5fd;
}
.gone h1 { font-size: 20px; }
.gone p { font-size: 13.5px; color: rgba(255,255,255,.6); line-height: 1.6; }

svg.icon { width: 20px; height: 20px; flex-shrink: 0; }
.hidden { display: none !important; }

/* ---------- профессиональная тема библиотеки ---------- */
:root {
  --bg: #f5f6fa;
  --ink: #171b2e;
  --muted: #697086;
  --primary: #6558e8;
  --primary-dark: #5145d5;
  --card: #ffffff;
  --line: #e6e8f0;
  --accent-bg: #f0efff;
  --dark: #101322;
  --stage-dark: #171a29;
  --radius: 18px;
  --shadow: 0 2px 4px rgba(20, 25, 50, .03), 0 10px 30px rgba(20, 25, 50, .05);
  --shadow-lg: 0 18px 45px rgba(20, 25, 50, .12);
}
body {
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  letter-spacing: -.01em;
}
body::before {
  background:
    radial-gradient(800px 500px at 8% -15%, rgba(101, 88, 232, .10), transparent 65%),
    radial-gradient(650px 450px at 100% 0%, rgba(69, 176, 199, .07), transparent 65%);
}
.wrap { max-width: 1240px; padding: 24px 28px 64px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 19px; font-weight: 800; letter-spacing: -.035em; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(145deg, #7467f1, #5145d5);
  box-shadow: 0 7px 18px rgba(101, 88, 232, .25);
}
.brand-mark .icon { width: 21px; height: 21px; }
.local-chip { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 600; }
.local-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #35b77b; box-shadow: 0 0 0 4px rgba(53, 183, 123, .11); }
.hero {
  min-height: 228px; padding: 38px 40px; border-radius: 26px; align-items: flex-end;
  background: linear-gradient(120deg, #1d223b 0%, #343161 52%, #6558e8 125%);
  box-shadow: 0 24px 55px rgba(32, 35, 73, .18);
}
.hero::after { width: 360px; height: 360px; right: -90px; top: -180px; border: 1px solid rgba(255,255,255,.11); background: rgba(255,255,255,.035); }
.hero::before { width: 260px; height: 260px; right: 140px; bottom: -190px; border: 1px solid rgba(255,255,255,.09); background: transparent; }
.hero-content { position: relative; z-index: 1; flex: 1; min-width: 260px; }
.eyebrow { display: flex; align-items: center; gap: 7px; color: #c8c4ff; font-size: 11px; line-height: 1; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 15px; }
.eyebrow .icon { width: 15px; height: 15px; }
.hero h1 { max-width: 620px; font-size: clamp(27px, 4vw, 40px); line-height: 1.13; letter-spacing: -.045em; font-weight: 750; }
.hero p { max-width: 580px; margin-top: 13px; color: rgba(255,255,255,.68); font-size: 14px; line-height: 1.6; }
.hero .btn { min-height: 50px; padding: 13px 22px; color: #342b92; box-shadow: 0 10px 25px rgba(5,8,25,.18); }
.hero-summary { display: flex; gap: 28px; margin-top: 24px; }
.hero-stat { display: flex; flex-direction: column; }
.hero-stat strong { font-size: 20px; line-height: 1.2; }
.hero-stat span { color: rgba(255,255,255,.52); font-size: 11px; margin-top: 3px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 34px 0 16px; }
.section-head h2 { font-size: 19px; letter-spacing: -.025em; }
.stats { margin: 0; font-size: 12px; font-weight: 600; }
.toolbar { gap: 10px; margin: 0 0 20px; flex-wrap: nowrap; }
.search { max-width: none; height: 44px; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 5px rgba(20,25,50,.02); }
.search input { font-size: 13px; }
.search kbd { border: 1px solid var(--line); background: #f7f8fb; border-radius: 5px; padding: 1px 6px; font: 10px inherit; color: #9298a8; white-space: nowrap; }
.select-wrap { position: relative; flex-shrink: 0; }
.select-wrap select {
  appearance: none; height: 44px; min-width: 172px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink); font: 600 12px inherit; padding: 0 36px 0 14px; cursor: pointer; outline: none;
}
.select-wrap::after { content: "⌄"; position: absolute; right: 13px; top: 9px; color: var(--muted); pointer-events: none; font-size: 17px; }
.select-wrap select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(101,88,232,.11); }
.view-switch { display: flex; padding: 3px; background: #e9ebf2; border-radius: 11px; flex-shrink: 0; }
.view-switch .icon-btn { width: 36px; height: 36px; border-radius: 8px; }
.view-switch .icon-btn.on { background: #fff; color: var(--primary); box-shadow: 0 2px 6px rgba(20,25,50,.09); }
.view-switch .icon { width: 17px; height: 17px; }
.grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.card { border-radius: 18px; border-color: rgba(225,228,237,.9); box-shadow: var(--shadow); }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card .cover { aspect-ratio: 16/9; margin: 8px 8px 0; border-radius: 12px; }
.card .cover img { background: #eeeff5; }
.card .cover .play { background: rgba(22, 20, 50, 0); }
.card .cover:hover .play { background: rgba(22, 20, 50, .28); }
.card .cover .play span { width: 48px; height: 48px; }
.card .body { padding: 16px 17px 12px; gap: 7px; }
.card h3 { font-size: 15px; line-height: 1.42; font-weight: 750; letter-spacing: -.015em; }
.card .desc { font-size: 12px; line-height: 1.55; min-height: 37px; }
.card .foot { padding: 12px 0 2px; border-color: #eff0f5; }
.onlyview { color: #328563; font-size: 10.5px; }
.date { font-size: 10.5px; }
.badge-count { font-size: 10px; right: 8px; bottom: 8px; padding: 4px 9px; }
.badge-demo, .badge-fx { font-size: 10px; top: 8px; left: 8px; padding: 4px 8px; }
.badge-fx { left: auto; right: 8px; color: #6558e8; background: rgba(247,246,255,.95); }
.icon-btn { width: 36px; height: 36px; }
.icon-btn .icon { width: 17px; height: 17px; }
.grid.list-view { display: flex; flex-direction: column; gap: 10px; }
.list-view .card { display: grid; grid-template-columns: 190px 1fr; animation-delay: 0s !important; }
.list-view .card:hover { transform: none; }
.list-view .cover { margin: 8px; }
.list-view .body { display: grid; grid-template-columns: minmax(150px, .65fr) 1fr auto; align-items: center; gap: 20px; padding: 15px 18px 15px 8px; }
.list-view .desc { min-height: 0; }
.list-view .foot { border: 0; margin: 0; padding: 0; gap: 20px; }
.empty { border: 1px dashed #d9dce8; border-radius: 18px; padding: 72px 24px; }
.empty .big { background: #eeedfc; }

/* ---------- плавность и доступность ---------- */
.btn { border-radius: 11px; font-size: 13px; transition: transform .18s ease, background .2s ease, box-shadow .2s ease, opacity .2s ease; }
.btn:hover { transform: translateY(-1px); }
.modal-back { background: rgba(15,18,34,.56); backdrop-filter: blur(8px); }
.modal { border-radius: 20px; padding: 26px; border: 1px solid rgba(255,255,255,.6); }
.modal h2 { font-size: 20px; letter-spacing: -.025em; }
.modal .sub { line-height: 1.6; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; }
.modal-head > div { flex: 1; }
.modal-close { margin: -8px -8px 0 0; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 25px 18px; }
.drop > .icon { width: 27px; height: 27px; color: var(--primary); }
.drop .hint { margin: 0; }
.toast { border: 1px solid rgba(255,255,255,.09); backdrop-filter: blur(12px); }
.toast.removing { opacity: 0; transform: translateY(8px); transition: .2s ease; }
:focus-visible { outline-color: var(--primary); }

/* ---------- просмотрщик ---------- */
.viewer { background: radial-gradient(1100px 700px at 50% -10%, #272c42, #101322 65%); }
.viewer header { padding: 12px 18px 10px; }
.viewer header h1 { font-size: 14px; font-weight: 650; }
.hbtn { width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.07); }
.hbtn:hover { background: rgba(255,255,255,.14); }
.pill { background: rgba(255,255,255,.07); color: rgba(255,255,255,.78); font-size: 11px; padding: 6px 11px; }
.progress { height: 2px; margin: 0 18px; }
.stage { padding: 16px 64px; }
.stage img.slide, .stage canvas.slide, .px-stage { border-radius: 5px; }
.arrow { width: 42px; height: 42px; background: rgba(255,255,255,.07); }
.arrow.left { left: 12px; } .arrow.right { right: 12px; }
.thumbs { padding: 9px 18px 5px; }
.thumbs .in { gap: 7px; justify-content: safe center; }
.thumbs button { width: 82px; height: 48px; border-radius: 6px; opacity: .4; }
.thumbs button.on { border-color: #8f83ff; box-shadow: 0 0 0 2px rgba(143,131,255,.16); }
.vfoot { padding: 8px 18px 12px; }
.overview { background: rgba(13,16,29,.96); padding: 24px; }
.ov-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.ov-cell { border-radius: 8px; }

@media (max-width: 767px) {
  .wrap { padding: 18px 14px 44px; }
  .topbar { margin-bottom: 22px; }
  .local-chip { font-size: 0; gap: 0; }
  .hero { min-height: 0; padding: 26px 22px; border-radius: 21px; display: block; }
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 13px; }
  .hero-summary { margin-top: 20px; gap: 24px; }
  .hero .btn { width: 100%; margin-top: 24px; }
  .section-head { margin-top: 26px; }
  .section-head h2 { font-size: 17px; }
  .toolbar { flex-wrap: wrap; }
  .search { flex-basis: 100%; }
  .search kbd { display: none; }
  .select-wrap { flex: 1; }
  .select-wrap select { width: 100%; }
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .list-view .card { grid-template-columns: 120px 1fr; }
  .list-view .body { display: flex; padding: 12px; gap: 7px; }
  .list-view .desc, .list-view .date, .list-view .onlyview { display: none; }
  .list-view .badge-demo, .list-view .badge-fx { display: none; }
  .list-view .badge-count { font-size: 8px; padding: 3px 6px; }
  .list-view .foot { margin-top: auto; width: 100%; }
  .stage { padding: 8px; }
  .viewer header { padding: 9px; gap: 7px; }
  .viewer header .meta { display: none; }
  .viewer header .hbtn { width: 36px; height: 36px; }
  .thumbs { display: none; }
  .overview { padding: 14px; }
  .ov-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ov-hint { display: none; }
  .modal { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- рабочее пространство ---------- */
:root {
  --bg: #f6f7f9;
  --ink: #20222b;
  --muted: #777c8c;
  --primary: #6758d9;
  --primary-dark: #5547c3;
  --line: #e8e9ee;
  --accent-bg: #f0eefc;
  --shadow: 0 1px 2px rgba(20,24,40,.025), 0 8px 24px rgba(20,24,40,.035);
  --shadow-lg: 0 16px 38px rgba(20,24,40,.09);
}
body { background: var(--bg); font-family: "Segoe UI", Inter, system-ui, sans-serif; }
body::before { display: none; }
.workspace { min-height: 100dvh; display: grid; grid-template-columns: 238px minmax(0,1fr); }
.sidebar {
  position: sticky; top: 0; height: 100dvh; z-index: 10; display: flex; flex-direction: column;
  padding: 27px 17px 18px; background: #171923; color: #fff; border-right: 1px solid rgba(255,255,255,.03);
}
.sidebar .brand { color: #fff; text-decoration: none; padding: 0 10px; margin-bottom: 42px; font-size: 22px; letter-spacing: -.045em; }
.brand-dot { color: #9d91ff; }
.sidebar .brand-mark { width: 34px; height: 34px; border-radius: 10px; background: #6d5ce7; box-shadow: none; }
.sidebar .brand-mark .icon { width: 18px; height: 18px; }
.nav-label { padding: 0 12px; margin-bottom: 10px; color: #6f7282; font-size: 9px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  width: 100%; min-height: 43px; display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  color: #9497a7; background: transparent; border: 0; border-radius: 9px; cursor: pointer;
  font: 550 12px/1.3 "Segoe UI",system-ui,sans-serif; text-align: left; transition: color .18s,background .18s;
}
.nav-item .icon { width: 17px; height: 17px; }
.nav-item span { flex: 1; }
.nav-item b { min-width: 20px; color: #676b7b; font-size: 10px; font-weight: 650; text-align: right; }
.nav-item:hover { color: #e4e4eb; background: rgba(255,255,255,.045); }
.nav-item.on { color: #fff; background: #292738; box-shadow: inset 2px 0 #8b7cf2; }
.nav-item.on .icon { color: #a99cf8; }
.nav-item.on b { color: #b4a9f9; }
.sidebar-bottom { margin-top: auto; }
.security-card { display: flex; align-items: flex-start; gap: 10px; padding: 14px 11px; margin-bottom: 17px; border: 1px solid rgba(255,255,255,.065); border-radius: 11px; background: rgba(255,255,255,.025); }
.security-card > .icon { width: 17px; height: 17px; color: #8f82e9; margin-top: 1px; }
.security-card strong { display: block; color: #c7c8d1; font-size: 10px; font-weight: 650; }
.security-card p { margin-top: 4px; color: #6e7180; font-size: 9px; line-height: 1.5; }
.profile { display: flex; align-items: center; gap: 9px; padding: 15px 8px 0; border-top: 1px solid rgba(255,255,255,.065); }
.avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #343143; color: #c4b9ff; font-size: 11px; font-weight: 700; }
.profile > div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.profile strong { color: #c5c6d0; font-size: 10px; font-weight: 600; }
.profile div span { color: #666978; font-size: 9px; margin-top: 2px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #55be8c; }
.main-panel { min-width: 0; }
.main-topbar { height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 36px; background: rgba(255,255,255,.75); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.breadcrumb { display: flex; align-items: center; gap: 9px; font-size: 10px; }
.breadcrumb span { color: #9a9da8; }
.breadcrumb b { color: #c8cad1; font-weight: 400; }
.breadcrumb strong { color: #5e626f; font-weight: 550; }
.main-topbar .local-chip { font-size: 9px; }
.content { max-width: 1390px; margin: 0 auto; padding: 35px 36px 60px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 29px; }
.overline { color: #8b7ddd; font-size: 8px; font-weight: 800; letter-spacing: .15em; margin-bottom: 7px; }
.page-heading h1 { color: #22232c; font-size: 29px; line-height: 1.2; letter-spacing: -.04em; font-weight: 720; }
.page-heading div > p:last-child { color: var(--muted); font-size: 11px; margin-top: 7px; }
.page-heading .btn { min-height: 41px; padding: 10px 16px; border-radius: 9px; font-size: 11px; box-shadow: 0 5px 14px rgba(103,88,217,.19); }
.page-heading .btn .icon { width: 16px; height: 16px; }
.metric-icon.violet { color: #7566d9; background: #f0edfc; }
.metric-icon.blue { color: #48849d; background: #ebf4f7; }
.metric-icon.amber { color: #b88743; background: #faf3e8; }
.collection-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.collection-head > div { display: flex; align-items: baseline; gap: 11px; }
.collection-head h2 { color: #30313b; font-size: 14px; letter-spacing: -.02em; }
.collection-head .stats { color: #a0a3ad; font-size: 9px; }
.toolbar { margin-bottom: 17px; gap: 9px; }
.search { height: 40px; border-radius: 9px; background: #fff; }
.search > .icon { width: 16px; height: 16px; }
.search input { font-size: 11px; }
.search kbd { font-size: 8px; }
.select-wrap select { height: 40px; min-width: 154px; border-radius: 9px; font-size: 10px; }
.select-wrap::after { top: 7px; font-size: 15px; }
.view-switch { background: #e9eaf0; border-radius: 9px; }
.view-switch .icon-btn { width: 32px; height: 32px; }
.grid { grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); gap: 17px; }
.card { border-radius: 13px; border-color: #e6e7ec; box-shadow: var(--shadow); }
.card:hover { transform: translateY(-2px); }
.card .cover { margin: 0; border-radius: 0; border-bottom: 1px solid #edeef2; }
.card .cover img { transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.card .cover .play span { width: 43px; height: 43px; box-shadow: 0 8px 25px rgba(20,20,35,.25); }
.card .cover .play span .icon { width: 18px; height: 18px; }
.card .body { padding: 14px 15px 10px; gap: 8px; }
.card-title-row { display: flex; align-items: flex-start; gap: 8px; }
.card-title-row h3 { flex: 1; min-width: 0; }
.card h3 { font-size: 12px; font-weight: 650; line-height: 1.5; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { color: var(--primary); }
.favorite { width: 25px; height: 25px; margin: -4px -4px 0 0; }
.favorite .icon { width: 15px; height: 15px; }
.favorite.on { color: #d25570; background: #fff0f3; }
.favorite.on .icon { fill: currentColor; }
.card .desc { min-height: 34px; font-size: 10px; line-height: 1.65; color: #858995; }
.card-tags { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #a0a3ad; font-size: 8px; }
.card .foot { min-height: 36px; margin-top: 2px; padding: 9px 0 0; border-color: #eff0f3; }
.open-link { display: inline-flex; align-items: center; gap: 6px; color: #6255c7; text-decoration: none; font-size: 9px; font-weight: 650; }
.open-link .icon { width: 11px; height: 11px; }
.open-link:hover { color: #4535b1; }
.card-actions { display: flex; }
.card-actions .icon-btn { width: 28px; height: 28px; }
.card-actions .icon { width: 14px; height: 14px; }
.badge-demo,.badge-fx { font-size: 8px; padding: 4px 7px; }
.badge-count { font-size: 8px; }
.empty { background: #fff; border-color: #e1e3e9; }
.list-view .card { grid-template-columns: 180px 1fr; }
.list-view .body { grid-template-columns: minmax(180px,.75fr) 1fr auto; padding: 13px 16px 13px 0; gap: 18px; }
.list-view .card-title-row { align-items: center; }
.list-view .card .foot { min-height: 0; }
.list-view .card-tags { display: none; }
.list-view .cover { border-bottom: 0; border-right: 1px solid #edeef2; }

.breadcrumb { font-size: 11px; }
.collection-head .stats { font-size: 10px; }
.search input { font-size: 12px; }
.card h3 { font-size: 14px; }
.card .desc { font-size: 11px; }
.card-tags { font-size: 9px; }
.open-link { font-size: 10px; }

@media (min-width: 1500px) {
  .workspace { grid-template-columns: 254px minmax(0,1fr); }
  .content { padding-left: 44px; padding-right: 44px; }
  .grid { grid-template-columns: repeat(auto-fill,minmax(285px,1fr)); }
}
@media (max-width: 980px) {
  .workspace { grid-template-columns: 194px minmax(0,1fr); }
  .sidebar { padding-left: 11px; padding-right: 11px; }
  .sidebar .brand { padding-left: 8px; }
  .security-card { display: none; }
  .content { padding: 28px 24px 45px; }
  .main-topbar { padding: 0 24px; }
  .nav-item { font-size: 10px; gap: 8px; }
  .grid { grid-template-columns: repeat(auto-fill,minmax(230px,1fr)); }
}
@media (max-width: 700px) {
  .workspace { display: block; }
  .sidebar { position: static; height: auto; padding: 15px 14px 10px; }
  .sidebar .brand { margin: 0 0 16px; padding: 0 3px; font-size: 20px; }
  .nav-label,.sidebar-bottom { display: none; }
  .side-nav { flex-direction: row; gap: 5px; }
  .nav-item { flex: 1; min-height: 38px; justify-content: center; padding: 7px; gap: 6px; }
  .nav-item span { display: none; }
  .nav-item b { min-width: 0; font-size: 9px; }
  .nav-item.on { box-shadow: none; }
  .main-topbar { height: 43px; padding: 0 16px; }
  .main-topbar .local-chip { display: none; }
  .content { padding: 25px 15px 45px; }
  .page-heading { align-items: flex-end; margin-bottom: 24px; }
  .page-heading h1 { font-size: 26px; }
  .page-heading div > p:last-child { max-width: 210px; line-height: 1.5; }
  .page-heading .btn { width: 41px; min-width: 41px; padding: 0; font-size: 0; }
  .page-heading .btn .icon { width: 18px; height: 18px; }
  .collection-head { margin-bottom: 12px; }
  .grid { grid-template-columns: 1fr; }
  .card .body { padding: 15px; }
  .card h3 { font-size: 13px; }
  .card .desc { font-size: 11px; }
  .card-tags { font-size: 9px; }
  .open-link { font-size: 10px; }
  .list-view .card { grid-template-columns: 112px 1fr; }
  .list-view .body { display: flex; padding: 11px; }
  .list-view .card-title-row { width: 100%; }
  .list-view .card h3 { font-size: 11px; }
  .list-view .card .foot { width: 100%; }
  .list-view .open-link { font-size: 0; }
  .list-view .open-link .icon { width: 13px; height: 13px; }
}

/* ---------- профессиональный режим показа ---------- */
.viewer { background: #0e1015; color: #f4f4f6; }
.viewer::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(900px 500px at 50% 20%,rgba(93,86,140,.09),transparent 70%); }
.viewer header { position: relative; z-index: 40; height: 62px; padding: 0 20px; gap: 16px; background: rgba(20,22,29,.96); border-bottom: 1px solid rgba(255,255,255,.065); }
.viewer-leading { display: flex; align-items: center; gap: 9px; }
.viewer-logo { width: 28px; height: 28px; display: grid; place-items: center; color: #a99bf8; }
.viewer-logo .icon { width: 20px; height: 20px; }
.viewer header .ttl { padding-left: 16px; border-left: 1px solid rgba(255,255,255,.08); }
.viewer header h1 { font-size: 12px; font-weight: 550; letter-spacing: 0; }
.viewer header .meta { max-width: 540px; margin-top: 3px; font-size: 9px; color: #717580; }
.viewer-tools { display: flex; align-items: center; gap: 5px; }
.tool-separator { width: 1px; height: 20px; margin: 0 5px; background: rgba(255,255,255,.09); }
.hbtn { width: 34px; height: 34px; border-radius: 8px; color: #a2a5b0; background: transparent; }
.hbtn .icon { width: 17px; height: 17px; }
.hbtn:hover { color: #fff; background: rgba(255,255,255,.075); transform: none; }
.hbtn.on { color: #d6ceff; background: rgba(120,99,224,.2); box-shadow: none; }
.progress { position: relative; z-index: 40; height: 2px; margin: 0; background: #20222a; border-radius: 0; }
.progress i { background: #7967df; border-radius: 0; transition: width .35s cubic-bezier(.2,.7,.2,1); }
.stage { z-index: 1; padding: 24px 70px; }
.stage img.slide,.stage canvas.slide,.px-stage { border-radius: 3px; box-shadow: 0 25px 75px rgba(0,0,0,.48),0 0 0 1px rgba(255,255,255,.045); }
.arrow { width: 38px; height: 56px; border-radius: 9px; color: #777c89; background: transparent; backdrop-filter: none; }
.arrow .icon { width: 20px; height: 20px; }
.arrow:hover { color: #fff; background: rgba(255,255,255,.07); transform: translateY(-50%); }
.arrow.left { left: 17px; }.arrow.right { right: 17px; }
.thumbs { position: relative; z-index: 20; max-height: 82px; padding: 10px 20px 11px; background: #14161c; border-top: 1px solid rgba(255,255,255,.055); opacity: 1; transition: max-height .25s,padding .25s,opacity .2s,transform .25s; }
.thumbs .in { gap: 7px; justify-content: flex-start; }
.thumbs button { width: 84px; height: 49px; border: 1px solid transparent; border-radius: 5px; opacity: .38; }
.thumbs button.on { border-color: #8b7aeb; opacity: 1; transform: none; box-shadow: 0 0 0 2px rgba(139,122,235,.16); }
.thumbs-hidden .thumbs { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; overflow: hidden; pointer-events: none; }
.vfoot { position: relative; z-index: 35; min-height: 62px; justify-content: center; padding: 9px 20px; background: #14161c; border-top: 1px solid rgba(255,255,255,.055); }
.playback-controls { display: flex; align-items: center; gap: 6px; padding: 4px; border: 1px solid rgba(255,255,255,.075); border-radius: 11px; background: #1b1d25; box-shadow: 0 5px 18px rgba(0,0,0,.16); }
.control-btn { height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; border: 0; border-radius: 7px; color: #a3a6b1; background: transparent; cursor: pointer; font: 550 10px "Segoe UI",system-ui,sans-serif; transition: color .15s,background .15s; }
.control-btn:hover { color: #fff; background: rgba(255,255,255,.065); }
.control-btn .icon { width: 14px; height: 14px; }
.control-btn.primary-control { color: #e4dfff; background: #5f50c3; }
.control-btn.primary-control:hover { background: #7060d5; }
.autoplay-btn { border-left: 1px solid rgba(255,255,255,.065); border-right: 1px solid rgba(255,255,255,.065); border-radius: 0; }
.autoplay-btn.playing { color: #c8befa; }
.pause-symbol { font-size: 12px; font-weight: 800; letter-spacing: -2px; }
.playback-controls .pill { min-width: 59px; padding: 5px 9px; color: #8c909d; background: transparent; font-size: 10px; text-align: center; }
.autoplay-menu { position: absolute; left: 50%; bottom: 58px; transform: translateX(-50%); min-width: 255px; padding: 11px 13px; border: 1px solid rgba(255,255,255,.09); border-radius: 10px; background: #22242d; box-shadow: 0 12px 30px rgba(0,0,0,.3); }
.autoplay-menu > span { display: block; margin-bottom: 8px; color: #858995; font-size: 9px; }
.autoplay-menu > div { display: flex; gap: 5px; }
.autoplay-menu button { flex: 1; padding: 6px 10px; border: 0; border-radius: 6px; color: #9da1ad; background: #2c2f39; cursor: pointer; font: 550 9px inherit; }
.autoplay-menu button.on { color: #fff; background: #6555c5; }
.vfoot .note { position: absolute; left: 20px; max-width: 260px; color: #5f636e; font-size: 8px; text-align: left; }
.viewer.idle .vfoot { opacity: 0; }
.viewer.fullscreen header { position: absolute; top: 0; left: 0; right: 0; z-index: 50; background: rgba(18,20,26,.72); backdrop-filter: blur(14px); }
.viewer.fullscreen .progress { position: absolute; top: 62px; left: 0; right: 0; z-index: 50; }
.viewer.fullscreen .stage { flex: 1; padding: 0; }
.viewer.fullscreen .thumbs,.viewer.fullscreen .vfoot { display: none; }
.viewer.fullscreen img.slide,.viewer.fullscreen canvas.slide,.viewer.fullscreen .px-stage { border-radius: 0; box-shadow: none; }
.overview { z-index: 60; background: rgba(12,14,19,.97); padding: 24px 30px; }
.ov-head { min-height: 38px; font-size: 13px; }
.ov-grid { grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 15px; padding: 8px 3px 20px; }
.ov-cell { border: 1px solid rgba(255,255,255,.1); border-radius: 7px; }
.ov-cell.on { border-color: #8b7aeb; box-shadow: 0 0 0 2px rgba(139,122,235,.25); }

@media (max-width: 767px) {
  .viewer header { height: 52px; padding: 0 8px; gap: 7px; }
  .viewer-logo,.viewer header .meta,.tool-separator,#v-thumbs-toggle { display: none; }
  .viewer header .ttl { padding-left: 4px; border: 0; }
  .viewer header h1 { font-size: 10px; }
  .viewer-tools { gap: 1px; }
  .viewer header .hbtn { width: 32px; height: 32px; }
  #v-help { display: none; }
  .stage { padding: 12px 7px; }
  .vfoot { min-height: 60px; padding: 8px; }
  .control-btn { padding: 0 10px; }
  .control-btn span { font-size: 9px; }
  .vfoot .note { display: none; }
  .autoplay-menu { bottom: 56px; }
  .overview { padding: 14px; }
}

/* ---------- финальный визуальный уровень ---------- */
body { background: linear-gradient(180deg,#fbfbfc 0%,#f4f5f7 58%,#f1f2f5 100%); }
.workspace::after {
  content: ""; position: fixed; top: -260px; right: -220px; width: 580px; height: 580px;
  border-radius: 50%; pointer-events: none; z-index: 0;
  background: radial-gradient(circle,rgba(103,88,217,.075),transparent 66%);
}
.sidebar { background: linear-gradient(180deg,#151721 0%,#191b27 55%,#141620 100%); box-shadow: 16px 0 40px rgba(15,18,28,.13); }
.sidebar::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(135deg,rgba(255,255,255,.035),transparent 42%); }
.sidebar > * { position: relative; }
.main-panel { position: relative; z-index: 1; }
.main-topbar { background: rgba(251,251,252,.72); box-shadow: 0 1px 0 rgba(20,24,40,.025); }
.page-heading h1 { font-size: 34px; font-weight: 760; letter-spacing: -.055em; }
.page-heading > div > p:last-child { font-size: 12px; }
.page-heading .btn { background: #20222c; box-shadow: 0 8px 22px rgba(22,24,35,.18); }
.page-heading .btn:hover { background: #343744; }
.collection-head { margin-bottom: 17px; }
.collection-head h2 { font-size: 16px; }
.collection-head .stats { font-size: 11px; }
.search { border-color: #e2e4ea; box-shadow: 0 1px 2px rgba(20,24,40,.018); }
.search:focus-within { border-color: #7d70df; box-shadow: 0 0 0 3px rgba(103,88,217,.085); }
.grid { gap: 20px; }
.card { border: 1px solid rgba(226,228,234,.9); border-radius: 15px; background: linear-gradient(180deg,#fff,#fdfdfe); }
.card:hover { transform: translateY(-3px); box-shadow: 0 18px 42px rgba(20,24,40,.09); }
.card .cover { background: #f3f3f5; }
.card .cover img { filter: saturate(1.02); }
.card .body { padding: 16px 17px 12px; }
.card h3 { font-size: 14px; font-weight: 700; letter-spacing: -.018em; }
.card .desc { font-size: 11px; min-height: 36px; }
.card-tags { font-size: 9px; }
.card .foot { border-top-color: #eef0f3; }
.open-link { padding: 6px 9px; border-radius: 7px; background: #f1effc; color: #5d4fd0; font-size: 10px; transition: background .15s,color .15s; }
.open-link:hover { background: #e8e4fb; color: #4536bb; }
.nav-item { border-radius: 10px; }
.nav-item.on { background: linear-gradient(90deg,rgba(116,99,231,.2),rgba(116,99,231,.07)); box-shadow: inset 2px 0 #9485f1; }
.security-card { border-radius: 13px; background: linear-gradient(145deg,rgba(255,255,255,.045),rgba(255,255,255,.018)); }
.viewer { background: radial-gradient(1200px 720px at 50% 18%,#181b25,#090a0e 72%); }
.viewer header { border-bottom-color: rgba(255,255,255,.045); box-shadow: 0 10px 34px rgba(0,0,0,.12); }
.viewer header .ttl { border-left-color: rgba(255,255,255,.075); }
.stage { background: radial-gradient(900px 520px at 50% 50%,rgba(255,255,255,.018),transparent 70%); }
.stage img.slide,.stage canvas.slide,.px-stage { box-shadow: 0 32px 90px rgba(0,0,0,.58),0 0 0 1px rgba(255,255,255,.055); }
.thumbs { box-shadow: 0 -12px 34px rgba(0,0,0,.12); }
.vfoot { box-shadow: 0 -12px 34px rgba(0,0,0,.13); }
.playback-controls { border-color: rgba(255,255,255,.085); background: rgba(27,29,37,.96); }
.control-btn.primary-control { background: linear-gradient(135deg,#7465d9,#5d4ec7); }

@media (max-width: 700px) {
  .page-heading h1 { font-size: 29px; }
  .card h3 { font-size: 14px; }
}

/* ---------- авторизация и роли ---------- */
.auth-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(800px 520px at 18% 10%,rgba(103,88,217,.11),transparent 66%),#f6f7f9; }
.auth-card { width: min(430px,100%); padding: 36px; border: 1px solid rgba(228,230,236,.9); border-radius: 22px; background: rgba(255,255,255,.92); box-shadow: 0 24px 70px rgba(20,24,40,.1); animation: fadeUp .3s ease both; }
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 35px; color: #1e2029; font-size: 23px; font-weight: 800; letter-spacing: -.045em; }
.auth-copy { margin-bottom: 27px; }
.auth-copy h1 { margin-top: 7px; color: #20222b; font-size: 27px; letter-spacing: -.04em; }
.auth-copy > p:last-child { margin-top: 8px; color: #777c8c; font-size: 12px; line-height: 1.6; }
.auth-submit { width: 100%; margin-top: 4px; }
.auth-page .field input { background: #fff; }
.top-role { padding: 6px 11px; border: 1px solid #e4e5ec; border-radius: 999px; color: #666b7b; font-size: 9px; font-weight: 750; }
.top-role.admin { border-color: #d8d1fa; color: #6252c9; background: #f4f1ff; }
.profile { position: relative; align-items: center; gap: 10px; padding: 13px; border: 1px solid rgba(255,255,255,.07); border-radius: 14px; background: rgba(255,255,255,.032); }
.profile .avatar { width: 35px; height: 35px; color: #fff; background: linear-gradient(145deg,#7566df,#5d4ec8); }
.profile strong { font-size: 11px; }
.profile div span { margin-top: 3px; color: #8a8d9b; font-size: 9px; }
.profile .icon-btn { width: 31px; height: 31px; color: #777b8a; }
.profile .icon-btn:hover { color: #fff; background: rgba(255,255,255,.075); }
.share-meta { margin-top: 4px; color: #8d919e; font-size: 9px; line-height: 1.45; }
.share-item { align-items: flex-start; }
.share-item .info { padding: 2px 0; }
.empty > p { color: #596779; }

@media (max-width: 700px) {
  .auth-card { padding: 28px 24px; }
  .auth-copy h1 { font-size: 24px; }
  .top-role { display: none; }
  .profile { margin-top: 14px; }
}

/* Library card actions — v11.2 (viewer styles deliberately untouched) */
.workspace .card {transition:transform 180ms ease,box-shadow 180ms ease;}
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  .workspace .card:hover {transform:translateY(-3px);box-shadow:0 12px 28px rgba(26,48,73,.13);}
}
.workspace .card .cover {position:relative;}
.workspace .card .cover-favorite {position:absolute;z-index:4;top:10px;right:10px;width:36px;height:36px;margin:0;border:1px solid rgba(255,255,255,.65);border-radius:11px;background:rgba(255,255,255,.85);color:#42556c;backdrop-filter:blur(8px);display:grid;place-items:center;transition:background 160ms ease,transform 160ms ease,color 160ms ease;}
.workspace .card .cover-favorite .icon {width:19px;height:19px;transition:transform 160ms ease,fill 160ms ease;}
.workspace .card .cover-favorite.on {color:#dc9651;background:rgba(255,248,229,.95);}
.workspace .card .cover-favorite.on .icon {fill:currentColor;transform:scale(1.09);}
.workspace .card .cover-favorite:hover {transform:scale(1.06);}
.workspace .card .card-actions .card-share {display:inline-flex;align-items:center;gap:5px;width:auto;height:30px;padding:4px 8px;font-size:12px;white-space:nowrap;position:relative;z-index:3;}
.workspace .card .card-actions .card-share .icon {width:15px;height:15px;}
.workspace .card .card-actions .card-share:disabled {opacity:.55;cursor:wait;}
.workspace .card .card-actions {display:flex;align-items:center;gap:5px;flex-shrink:0;flex-wrap:nowrap;}
.workspace .card .card-title-row {align-items:flex-start;gap:8px;}
.workspace .card .card-title-row h3 {min-width:0;overflow-wrap:anywhere;}
.workspace .card :is(button,input,a):focus-visible {outline:2px solid #397bb4;outline-offset:3px;}
.presentation-context-menu {position:fixed;z-index:10000;width:max-content;min-width:235px;max-width:calc(100vw - 16px);padding:6px;background:#fff;color:#26384b;border:1px solid rgba(39,63,91,.12);border-radius:14px;box-shadow:0 16px 44px rgba(24,43,66,.22),0 2px 8px rgba(24,43,66,.08);transform-origin:top left;animation:present-context-enter 140ms ease-out both;}
.presentation-context-menu .context-menu-item {width:100%;display:flex;align-items:center;gap:11px;text-align:left;padding:10px 12px;border:0;border-radius:9px;background:transparent;color:inherit;font:inherit;font-size:13px;cursor:pointer;min-height:40px;transition:background 150ms ease;}
.presentation-context-menu .context-menu-item .icon {width:17px;height:17px;flex:none;}
.presentation-context-menu .context-menu-item:hover,.presentation-context-menu .context-menu-item:focus-visible {background:#edf3f9;outline:2px solid transparent;}
.presentation-context-menu .context-menu-item:focus-visible {box-shadow:inset 0 0 0 2px #5089b7;}
.presentation-context-menu .context-menu-item.danger {color:#b93f4b;border-top:1px solid #edf0f3;border-radius:0 0 9px 9px;margin-top:3px;}
.presentation-context-menu .context-menu-item.danger:hover {background:#fff0f0;}
@keyframes present-context-enter {from {opacity:0;transform:scale(.96) translateY(-3px);}to {opacity:1;transform:scale(1) translateY(0);}}
@media(max-width:520px) {.workspace .card .card-actions .card-share {min-height:36px;padding:6px 8px;}.workspace .card .cover-favorite {width:40px;height:40px;top:8px;right:8px;}.presentation-context-menu .context-menu-item {min-height:44px;}}
@media(prefers-reduced-motion:reduce) {.presentation-context-menu {animation:none;}.workspace .card,.workspace .card .cover-favorite,.workspace .card .cover-favorite .icon {transition:none;}}

/* v5.3: folder navigation, icon chooser, responsive toolbar */
.workspace .folder-shortcut .folder-svg {width:19px;height:19px;flex-shrink:0}
.workspace .folder-shortcut b {margin-left:auto;font-variant-numeric:tabular-nums}
.workspace .folder-shortcut.drop-target {background:#dcecff;outline:2px solid #6b9ae6;outline-offset:-2px}
.folder-icon-picker {display:grid;grid-template-columns:repeat(auto-fill,minmax(44px,1fr));gap:7px;max-height:230px;overflow-y:auto;margin:12px 0 20px;padding:5px}
.folder-icon-option {display:grid;place-items:center;min-height:42px;border:1px solid #e0e5eb;border-radius:10px;background:#fff;color:#455c76;cursor:pointer;transition:background .14s,border-color .14s}
.folder-icon-option .icon {width:21px;height:21px}
.folder-icon-option:hover {background:#edf4ff}
.folder-icon-option.chosen {background:#e6f0ff;border-color:#477bc5;color:#245ba4}
.folder-management-name {display:flex;align-items:center;gap:10px;min-width:0}
.folder-management-name .icon {width:20px;height:20px;flex-shrink:0}
.folder-management-name strong {overflow-wrap:anywhere}
.folder-management-name small {color:#73839a}
.slide-match {font-size:12px;line-height:1.5;color:#66788e;overflow-wrap:anywhere;margin:6px 0 0}
.slide-match mark {background:#fff0b7;color:inherit;border-radius:3px;padding:0 2px}
.workspace .toolbar {display:flex;flex-wrap:wrap;align-items:center;gap:10px}
.workspace .toolbar .search {min-width:160px;flex:1 1 220px}
.workspace .toolbar .select-wrap {flex:0 1 auto;min-width:130px;max-width:100%}
.workspace .toolbar select {max-width:100%;min-width:0}
.workspace .card .body {min-width:0}
@media(max-width:844px){.workspace .toolbar .select-wrap{flex:1 1 145px}.workspace .toolbar .view-switch{flex-shrink:0}}
@media(max-width:400px){.workspace .toolbar .search{flex-basis:100%}.workspace .toolbar .select-wrap{flex:1 1 120px;min-width:0}.management-row{flex-wrap:wrap;gap:10px}}
