/* Sonviz — фон сцены и новый список слоёв (15.11, claude/bg-layers.md;
   макеты — холст «Sonviz — неделя 2: фон и слои»). Строки фона строит
   js/studio/bg-ui.js, список слоёв — js/studio/panel.js. */

/* ---------- переключатели в одну полосу ---------- */
.bg-seg { display: grid; border: 1px solid var(--line2); border-radius: 4px; overflow: hidden; }
.bg-seg3 { grid-template-columns: repeat(3, 1fr); }
.bg-seg4 { grid-template-columns: repeat(4, 1fr); }
.bg-seg button { height: 30px; border: 0; border-left: 1px solid var(--line2); border-radius: 0;
  background: transparent; color: var(--dim); font-family: inherit; font-size: 12.5px; font-weight: 500; padding: 0 4px; cursor: pointer;
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bg-seg button:first-child { border-left: 0; }
.bg-seg button:hover { background: var(--hover); color: var(--fg); }
.bg-seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.bg-seg4 button.on { background: rgba(176, 199, 217, .2); color: var(--fg); }
.bg-seg button.locked { color: var(--dim2); }
.bg-seg button.locked::before { content: ''; display: inline-block; width: 9px; height: 10px; margin-right: 5px; vertical-align: -1px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 11V8a5 5 0 0 1 10 0v3h1a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2zm2 0h6V8a3 3 0 0 0-6 0z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 11V8a5 5 0 0 1 10 0v3h1a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2zm2 0h6V8a3 3 0 0 0-6 0z'/%3E%3C/svg%3E") center/contain no-repeat; }
.bg-kind-row { position: relative; }
.bg-kind-row .bg-seg { grid-column: 1 / -1; }
.bg-checker { grid-column: 1 / -1; height: 44px; margin-top: 8px; border-radius: 3px; border: 1px solid var(--line2);
  background-color: #1a1d22;
  background-image: linear-gradient(45deg, #262a30 25%, transparent 25%, transparent 75%, #262a30 75%),
                    linear-gradient(45deg, #262a30 25%, transparent 25%, transparent 75%, #262a30 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.bg-lock-pop { position: absolute; z-index: 20; right: 0; top: 40px; width: 250px; padding: 12px; border: 1px solid var(--line2);
  border-radius: 6px; background: var(--panel2); box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .85); display: flex; flex-direction: column; gap: 8px; }
.bg-lock-pop p { margin: 0; font-size: 12px; color: var(--dim); }
.bg-lock-pop .bg-login { align-self: flex-start; padding: 6px 14px; border-radius: 4px; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 12.5px; text-decoration: none; }

/* ---------- картинка ---------- */
.bg-image-row { display: flex; flex-direction: column; gap: 8px; border-radius: 4px; min-width: 0; max-width: 100%; }
.bg-image-row.drag { outline: 1px dashed rgba(255, 255, 255, .5); outline-offset: 2px; }
.bg-drop { min-height: 104px; border: 1.5px dashed rgba(176, 199, 217, .42); border-radius: 4px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; font-size: 12.5px; }
/* Длинное имя файла не выталкивает миниатюру за панель (16.11): строка
   не шире панели, имя — в одну строку с многоточием, целиком — в подсказке. */
.bg-cur { display: flex; gap: 10px; align-items: center; min-width: 0; width: 100%; }
.bg-thumb { position: relative; width: 112px; height: 63px; flex: none; border-radius: 3px; border: 1px solid var(--line2);
  background: #14161d center/cover no-repeat; cursor: crosshair; touch-action: none; }
.bg-thumb.dim { opacity: .45; cursor: default; }
.bg-dot, .bg-stage-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6); pointer-events: none; }
.bg-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; overflow: hidden; }
.bg-info b { display: block; max-width: 100%; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 11.5px; color: var(--dim); }
.bg-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.bg-pick, .bg-mine { height: 30px; padding: 0 10px; border-radius: 4px; border: 1px solid var(--line2); background: var(--tint);
  color: var(--fg); font: inherit; font-size: 12.5px; cursor: pointer; }
.bg-mine { background: transparent; align-self: flex-start; }
.bg-link-btn { border: 0; background: none; color: var(--dim); font: inherit; font-size: 12px; padding: 2px 4px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px; }
.bg-link-btn:hover { color: var(--fg); }
.bg-up { display: flex; gap: 10px; align-items: center; }
.bg-up-col { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.bg-up-pct { font-family: 'IBM Plex Mono', monospace; color: var(--dim); }
.bg-up-bar { height: 4px; border-radius: 2px; background: rgba(176, 199, 217, .2); position: relative; display: block; overflow: hidden; }
.bg-up-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: #9fe0bc; display: block; }
.bg-up-col .bg-link-btn { align-self: flex-start; }
.bg-err { padding: 8px 10px; border-radius: 4px; background: rgba(255, 111, 97, .1); border: 1px solid rgba(255, 111, 97, .35);
  font-size: 12.5px; color: #ffb3aa; }

/* ---------- точка фокуса поверх превью ---------- */
.bg-stage-layer { position: fixed; z-index: 30; display: none; pointer-events: none; }
.bg-stage-dot { width: 18px; height: 18px; margin: -9px 0 0 -9px; border-width: 2px; pointer-events: auto; cursor: grab; touch-action: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .55); }
.bg-stage-tip.left { left: auto; right: 22px; }
.bg-stage-tip { position: absolute; left: 22px; top: -4px; white-space: nowrap; padding: 2px 6px; border-radius: 3px;
  background: rgba(5, 6, 7, .75); font-size: 11.5px; color: var(--fg); font-style: normal; pointer-events: none; }

/* ---------- «Мои фоны» ---------- */
.bg-modal { position: fixed; inset: 0; z-index: 200; background: rgba(5, 6, 7, .78); display: flex; align-items: center; justify-content: center; }
.bg-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; border: 1px solid var(--line2);
  border-radius: 8px; background: var(--panel2); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .9); display: flex; flex-direction: column; color: var(--fg); }
.bg-dlg-head, .bg-dlg-foot { display: flex; align-items: center; gap: 10px; padding: 14px 18px; }
.bg-dlg-head { border-bottom: 1px solid var(--line); }
.bg-dlg-head b { font-size: 15px; }
.bg-dlg-foot { border-top: 1px solid var(--line); }
.bg-dlg-foot .primary { height: 32px; padding: 0 16px; border-radius: 4px; border: 0; background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 600; cursor: pointer; }
.bg-dlg-foot .primary:disabled { opacity: .5; cursor: default; }
.bg-x { width: 28px; height: 28px; border-radius: 4px; border: 0; background: transparent; color: var(--dim); cursor: pointer; font: inherit; }
.bg-x:disabled { color: var(--dim2); opacity: .5; cursor: not-allowed; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding: 18px; }
.bg-card { display: flex; flex-direction: column; gap: 6px; }
.bg-card-pic { position: relative; height: 120px; border-radius: 4px; border: 0; padding: 0; background: #14161d center/cover no-repeat; cursor: pointer; }
.bg-card.sel .bg-card-pic { outline: 2px solid var(--fg); outline-offset: 2px; }
.bg-tag { position: absolute; left: 8px; top: 8px; padding: 1px 6px; border-radius: 3px; background: var(--fg); color: var(--accent-ink);
  font-size: 11px; font-weight: 600; }
.bg-card-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bg-card-row b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bg-dialog .bg-err { margin: 0 18px 12px; }

/* ---------- список слоёв: фон внизу ---------- */
.layers-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.layers-meta .hint { flex: 1; }
.layers-count { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--dim); white-space: nowrap; }
.layers-empty { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 10px; }
.layers-empty p { margin: 0; font-size: 12.5px; color: #c9ced4; }
.layers-empty .add-layer.primary { background: var(--accent); color: var(--accent-ink); border-style: solid; font-weight: 600; }
.layers-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.layers-quick button { height: 48px; border-radius: 4px; border: 1px solid var(--line2); background: var(--panel2); color: var(--fg);
  font: inherit; font-size: 12px; cursor: pointer; }
.bg-notice { display: flex; flex-direction: column; gap: 8px; padding: 10px; margin-bottom: 10px; border-radius: 6px;
  border: 1px solid rgba(159, 224, 188, .35); background: rgba(159, 224, 188, .07); }
.bg-notice p { margin: 0; font-size: 12.5px; }
.bg-notice button { align-self: flex-start; height: 28px; padding: 0 10px; border-radius: 4px; border: 1px solid var(--line2);
  background: transparent; color: var(--fg); font: inherit; font-size: 12px; cursor: pointer; }
.layer-name .was-base { margin-left: 6px; font-weight: 400; color: #9fe0bc; }
.bg-link { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 8px; padding: 8px; border-radius: 6px;
  border: 1px solid rgba(229, 197, 143, .3); background: rgba(229, 197, 143, .05); color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.bg-link-thumb { width: 52px; height: 30px; flex: none; border-radius: 3px; background: #14161d center/cover no-repeat; border: 1px solid var(--line); }
.bg-link-thumb.checker { background-color: #1a1d22;
  background-image: linear-gradient(45deg, #262a30 25%, transparent 25%, transparent 75%, #262a30 75%),
                    linear-gradient(45deg, #262a30 25%, transparent 25%, transparent 75%, #262a30 75%);
  background-size: 10px 10px; background-position: 0 0, 5px 5px; }
.bg-link-txt { display: flex; flex-direction: column; }
.bg-link-txt b { font-size: 12.5px; color: #e5c58f; }
.bg-link-txt span { font-size: 11.5px; color: var(--dim); }
.tl-chip.bg { border-color: rgba(229, 197, 143, .45); background: rgba(229, 197, 143, .08); color: #e5c58f; font: inherit; cursor: pointer; }
