/* ═══ 슬라이드 배경 고르기 — 「배경」 탭 (2026-09-10 · 2026-11-08 이 파일로 옮김) ═══════════
   짝 = js/slide-bg-panel.js
   2026-11-08: 이름표 드롭다운을 걷고 «배경 찾기» 칸 + 연관 검색어 한 줄 + 「전체 · 표지 · 문제 판」으로 바꿨다(회신 1A·2A·3A).
   css/detail-kg-timeline.css 가 1,500줄 톱니에 닿아 이 화면의 모양을 통째로 이리 옮겼다.
   ★열 수를 못 박는다★ — `auto-fill` 은 좁은 패널(330px)에서 빈 트랙을 남긴다(UI_규칙 R083). */
.nq-bg-up {
  border: 2px dashed var(--border-strong); border-radius: 9px;
  background: var(--surface-hover);
}
.nq-bg-up-btn {
  display: block; width: 100%; padding: 15px 10px; border: 0; background: none;
  font-family: inherit; cursor: pointer; text-align: center; border-radius: 9px;
}
.nq-bg-up-btn b { display: block; font-size: 12.5px; font-weight: 800; color: var(--text-body); }
.nq-bg-up-btn span { display: block; font-size: 10.5px; color: var(--text-muted); margin-top: 3px; }   /* [design-ok] px-font-size 는 이 작업 범위 밖 — 이 줄은 흐린 글자색만 올렸다(F-20260926-18-2) */
.nq-bg-up-btn:hover { background: var(--primary-light); }

/* 「배경 찾기」 — 검색칸. 지우기 단추는 우리 것 하나만(브라우저가 붙이는 ✕ 를 끈다 · 두 개가 겹쳐 보였다). */
.nq-bg-find { margin: 11px 0 0; }
.nq-bg-find-lb { display: block; font-size: var(--text-sm); font-weight: 800; color: var(--text-muted); margin-bottom: 4px; }
.nq-bg-find-box { position: relative; }
.nq-bg-find-box .nq-bg-q { height: 34px; padding: 0 34px; font-size: var(--text-base); }
.nq-bg-q::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.nq-bg-find-ic { position: absolute; left: 10px; top: 9px; width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.nq-bg-find-x {
  position: absolute; right: 3px; top: 3px; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: var(--radius-xs); background: none; font-family: inherit; font-size: var(--text-base);
  color: var(--text-muted); cursor: pointer;
}
.nq-bg-find-x:hover { background: var(--surface-hover); }
.nq-bg-find-x:focus-visible { outline: 3px solid var(--primary); outline-offset: -1px; }

/* ★연관 검색어는 «한 줄»이다★ (2026-11-08 사용자 «연관검색어는 1줄로 유지하자»)
   줄 높이를 한 줄로 못 박고, 넘친 칩은 둘째 줄로 내려가 안 보인다 — 잘린 칩 반쪽이 보이지 않는다.
   그 칩에 Tab 이 닿지 않게 감추는 일은 js/slide-bg-panel.js fitChips 가 한다.
   위아래 3px = 초점 테두리(3px)가 줄 밖으로 잘리지 않을 자리. */
.nq-bg-rel {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  height: 34px; padding: 3px; margin: 5px -3px 6px; overflow: hidden;
}
.nq-bg-rel-lb { font-size: var(--text-sm); font-weight: 800; color: var(--text-muted); white-space: nowrap; line-height: 28px; }
.nq-bg-chip {
  height: 28px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  background: var(--surface); font-family: inherit; font-size: var(--text-sm); font-weight: 700;
  color: var(--text-body); white-space: nowrap; cursor: pointer;
}
.nq-bg-chip[hidden] { display: none; }
.nq-bg-chip:hover { background: var(--primary-light); }
.nq-bg-chip:focus-visible { outline: 3px solid var(--primary); outline-offset: 0; }

/* 「전체 · 표지 · 문제 판」 — 아래 «어디에 적용»과 같은 한 몸통 세그먼트(R049) · 숫자는 누르는 쪽에(R086).
   몸통이 overflow:hidden 이라 초점 테두리는 «안쪽»에 그린다 · 고른 칸(채운 면) 위에서는 흰 테두리. */
.nq-bg-use { margin: 0 0 9px; }
.nq-bg-use button { font-size: var(--text-sm); }
.nq-bg-use .nq-bg-n { font-weight: 600; }
.nq-bg-use button:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
.nq-bg-use button.on:focus-visible { outline-color: var(--text-on-primary); }

/* ★마지막 줄에 한 장만 남아도 «같은 크기로 왼쪽»에 둔다★ (2026-11-08 사용자 «카드 제일밑에 1개만있어도
   좌측에 카드크기 동일하게 1개만 배치») — 옛 규칙(홀수면 마지막 칸이 두 칸을 다 쓴다 · R016)을 이 화면에서는 끈다.
   그림을 고르는 칸이라 크기가 다르면 같은 그림이 다르게 잘려 보이고, 찾기·탭으로 장 수가 늘 바뀐다(UI_GUIDELINES_층3 편집기). */
.nq-bg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.nq-bg-cell {
  position: relative; height: 58px; padding: 0; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  display: flex; align-items: flex-end; font-family: inherit;
}
/* ★고른 것은 «테두리»로 말한다★ — 색만 바꾸면 배경 그림에 묻힌다(그림 위에 얹는 UI 다). */
.nq-bg-cell.on { outline: 3px solid var(--primary); outline-offset: -3px; }
.nq-bg-cell:focus-visible { outline: 3px solid var(--primary); outline-offset: 1px; }
/* ★그림은 이름 띠(18px) «위»에만 깔고 아래쪽을 보인다★ — 유아용 배경(b07~)은 장식이 아래 띠에만 있어서,
   칸 전체에 가운데 맞춤으로 깔면 장식이 잘리거나 이름 띠에 덮여 칸마다 빈 색 카드로 보였다(2026-11-08). */
.nq-bg-thumb { position: absolute; inset: 0 0 18px; background-size: cover; background-position: center bottom; }
/* ★캡션은 «불투명 띠»다★ — 반투명 그라데이션은 옅은 파스텔 배경 위에서 흰 글자가 안 읽힌다
   (2026-09-10 목업 검수에서 실제로 걸린 것과 같은 자리). */
.nq-bg-cap {
  position: relative; width: 100%; padding: 3px 6px; font-size: 10px; font-weight: 700;
  color: #fff; background: rgba(15, 23, 42, .78);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nq-bg-none { align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--text-muted); }

/* ★그림 칸은 한 쪽 8칸 · 「‹ 이전 · 3 / 8 · 다음 ›」로 넘긴다★ (2026-11-11 사용자 · R280)
   쪽이 여럿이면 그림 칸 높이를 4줄로 지킨다 — 마지막 쪽에 칸이 덜 차도 이전·다음 단추와 아래 «어디에 적용»이
   위로 끌려 올라오지 않는다(넘길 때마다 단추 자리가 움직이면 같은 자리를 연달아 누를 수 없다). */
.nq-bg-grid.is-paged { min-height: calc(58px * 4 + 7px * 3); align-content: start; }
.nq-bg-pager { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; }
.nq-bg-pager button {
  height: 30px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); font-family: inherit; font-size: var(--text-sm); font-weight: 700;
  color: var(--text-body); white-space: nowrap; cursor: pointer;
}
.nq-bg-pager button:hover:not(:disabled) { background: var(--primary-light); }
.nq-bg-pager button:disabled { cursor: default; opacity: .5; }
.nq-bg-pager button:focus-visible { outline: 3px solid var(--primary); outline-offset: 1px; }
.nq-bg-page-n { font-size: var(--text-sm); font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.nq-bg-note { margin: 8px 0 0; font-size: var(--text-sm); color: var(--text-muted); word-break: keep-all; }

/* ★«이전·다음» + «어디에 적용» + «글자 잘 보이게»는 한 덩어리로 오른쪽 칸 바닥에 붙는다★ (2026-11-11 · 결정 A2 · R280 7항)
   1366×768 노트북에서 «어디에 적용»이 94px 아래로 밀려 내려야 보였다. 오른쪽 칸(#editorPanel)이 스크롤되면
   그림 칸이 이 덩어리 «밑»으로 지나가고, 넘기기·적용·옅게는 늘 바닥에 보인다. 화면이 넉넉하면 제자리에 그대로 있다.
   ⚠«어디에 적용»만 붙이면 1366×768 에서 이전·다음 줄이 그 밑에 가려진다(실측) — 그래서 셋을 한 덩어리로 묶었다.
   면을 칠해야 밑으로 지나가는 그림이 비치지 않는다(오른쪽 칸 면 = --surface). */
.nq-bg-foot { position: sticky; bottom: 0; z-index: 2; background: var(--surface); padding-bottom: 12px; }
.nq-bg-scope { margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--border); }
.nq-bg-scope-h {
  font-size: 10.5px; font-weight: 800; letter-spacing: .4px;
  color: var(--text-muted); margin-bottom: 6px;
}
/* 「둘 중 하나」는 한 몸통 세그먼트로 — 떨어진 알약 2개로 그리지 않는다(UI_규칙 R049). */
.nq-bg-seg { display: flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.nq-bg-seg button {
  flex: 1; padding: 7px 4px; border: 0; background: var(--surface); font-family: inherit;
  font-size: 11px; font-weight: 700; color: var(--text-muted); cursor: pointer;
}
.nq-bg-seg button.on { background: var(--primary-fill); color: var(--text-on-primary); }
.nq-bg-seg button:disabled { cursor: default; opacity: .5; }

.nq-bg-dim { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
/* 오른쪽 아래 «ALC 도우미»(#supLauncher · right 20 · bottom 20 · 50px 원)가 막대 끝(가장 옅게)을 덮었다(1366×768 · 1440×900 실측).
   도우미가 떠 있는 동안은 막대가 그 원 왼쪽에서 끝난다. */
html:has(#supLauncher:not([hidden])) #nqBgBody .nq-bg-dim { margin-right: 52px; }
.nq-bg-dim > span { font-size: 11px; font-weight: 700; color: var(--text-body); white-space: nowrap; }
.nq-bg-dim input { flex: 1; min-width: 0; }
.nq-bg-dim.is-off > span { color: var(--text-faint); }   /* [design-ok] 꺼진 상태(`.is-off`) — 고를 수 없는 칸이라 비활성과 같은 예외 — faint 가 맞다(F-20260926-18-2) */
/* [D1 2026-11-12] «색 맞추기» 스위치 — «글자 잘 보이게» 바로 아래 · 글자 크기·굵기도 그 줄과 같게(알약 = css/detail-editor.css .v2-tline) */
#nqBgBody .nq-bg-pal { margin-top: 9px; }
#nqBgBody .nq-bg-pal .v2-tl-name { font-size: var(--text-xs); }
html:has(#supLauncher:not([hidden])) #nqBgBody .nq-bg-pal { width: auto; margin-right: 52px; }   /* 도우미 단추가 스위치를 가리지 않게(.nq-bg-dim 과 같다) */
#nqBgBody .nq-bg-pal.is-off { cursor: default; }
#nqBgBody .nq-bg-pal.is-off .v2-tl-name { color: var(--text-faint); }   /* [design-ok] 꺼진 상태(`.is-off`) — 배경이 없어 고를 수 없는 칸(.nq-bg-dim.is-off 와 같은 예외) */

/* ═══ 「그림 | 만들기」 판 (2026-11-17 · 배경 만들기 B2 2단계 · 짝 = js/slide-bg-make-panel.js · 설계 §5-5 · §11) ═══════════════
   맨 위 «그림 | 만들기» = 한 몸통 세그먼트(R049). 두 판을 같은 칸에 «겹쳐» 놓고 안 보이는 쪽은 visibility 로 감춘다 —
   감춘 쪽도 자리를 차지하므로 바닥 덩어리(이전·다음 · 어디에 적용 · 글자 잘 보이게 · 색 맞추기)가 판을 바꿔도 같은 자리에 선다(R280 7항).
   «만들기»에서는 그림 칸이 없어 «이전·다음» 줄 자리만 비워 둔다(자리를 옮기지 않으려고). */
.nq-bg-mode { margin: 0 0 8px; }
.nq-bg-mode button { font-size: var(--text-sm); }
.nq-bg-mode button:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
.nq-bg-mode button.on:focus-visible { outline-color: var(--text-on-primary); }
.nq-bg-main { display: grid; align-items: start; }
.nq-bg-pane { grid-area: 1 / 1; min-width: 0; }
.nq-bg-main[data-mode="make"] .nq-bg-pane-pic,
.nq-bg-main[data-mode="pic"] .nq-bg-pane-make { visibility: hidden; }
.nq-bg-main[data-mode="make"] ~ .nq-bg-foot .nq-bg-pgslot { visibility: hidden; }

/* 줄 넷 — 이름표 + 라디오 묶음. 이름표 글자는 «배경 찾기» 이름표와 같다. */
.nq-bgm-row { margin: 0 0 8px; }
.nq-bgm-lb { font-size: var(--text-sm); font-weight: 800; color: var(--text-muted); margin-bottom: 4px; }
.nq-bgm-opts { display: grid; gap: 6px; }
.nq-bgm-opt { position: relative; padding: 0; cursor: pointer; font-family: inherit; }
/* ★고른 것은 «겹 테두리 + ✓ 표»로 말한다★ — 색 동그라미는 색만으로는 골랐는지 안 보인다(§0-A 1 · 색만으로 구분하지 않는다). */
.nq-bgm-opt[aria-checked="true"] { box-shadow: 0 0 0 1px var(--surface), 0 0 0 4px var(--primary); }   /* [design-ok] 고름 링 — 초점 outline 과 따로 겹쳐 그리는 링이라 떠 있는 면용 --shadow-* 토큰이 맞지 않는다 */
.nq-bgm-opt[aria-checked="true"]::after {
  content: "✓"; position: absolute; right: 2px; bottom: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--primary-fill); color: var(--text-on-primary); font-size: var(--text-xs); font-weight: 800; line-height: 14px; text-align: center;
}
.nq-bgm-opt:focus-visible { outline: 2px solid var(--text-body); outline-offset: 2px; }
.nq-bgm-opt[aria-checked="true"]:focus-visible { outline-offset: 5px; }
/* 키보드로 닿은 칸이 붙어 있는 바닥 덩어리(.nq-bg-foot · sticky) 밑에 가리지 않게 — 화면이 낮으면(1366×768) 아래 줄이 그 밑으로 내려간다. 값 = 바닥 덩어리 높이 + 여유. */
.nq-bg-pane-make :is(button, input) { scroll-margin-bottom: 196px; }

/* 바탕 색 — 맨 앞 «없음» + 동그라미 9개 = 열 칸을 두 줄에(채움 = 그 벌의 바탕 · 테두리 = 그 벌의 선 색은 인라인).
   한 줄 9개일 때는 칸이 약 26px 이라 손가락으로 누르기에 작았다 — 칸마다 44px(2026-11-18 결정 3 B · 누르는 대상 44px 이상). */
.nq-bgm-dots { grid-template-columns: repeat(5, 44px); justify-content: space-between; padding: 5px 5px 6px; margin: -5px -5px -6px; gap: 6px; }
.nq-bgm-dot { width: 44px; height: 44px; border: 2px solid; border-radius: 50%; }
/* «없음» = 배경을 지운다(2026-11-18 결정 4 B) — 무늬 · 테두리의 «없음»과 같은 빗금. 이름은 aria-label · title. */
.nq-bgm-dot.is-none { background: var(--surface); border-color: var(--border-strong); }
.nq-bgm-dot.is-none::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 70%; height: 2px;
  background: var(--text-muted); transform: translate(-50%, -50%) rotate(-45deg); pointer-events: none;
}
.nq-bgm-dot[aria-checked="true"]::after { inset: 0; margin: auto; right: auto; bottom: auto; }

/* 흐름 — «한 색 | 두 색» 한 몸통 세그먼트(R049) · 칸은 라디오 */
.nq-bgm-flows { display: flex; gap: 0; }
.nq-bgm-flows .nq-bgm-flow:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
.nq-bgm-flows .nq-bgm-flow.on:focus-visible { outline-color: var(--text-on-primary); }

/* 무늬 · 테두리 견본 — 1280×720 무대를 0.6배로 줄여 «왼쪽 위 모서리»를 보인다(작은 칸에 무대 전체를 넣으면 띠·점이 점으로 사라진다) */
.nq-bgm-sws { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 5px 5px 6px; margin: -5px -5px -6px; }
.nq-bgm-sw { height: 36px; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.nq-bgm-sw-in { position: absolute; left: 0; top: 0; width: 1280px; height: 720px; transform: scale(.6); transform-origin: 0 0; pointer-events: none; }
.nq-bgm-sw.is-none::before {   /* «없음» = 글자 대신 빗금(이름은 aria-label · title) */
  content: ""; position: absolute; left: 50%; top: 50%; z-index: 1; width: 70%; height: 2px;
  background: var(--text-muted); transform: translate(-50%, -50%) rotate(-30deg); pointer-events: none;
}

/* ═══ 다섯째 줄 «장식» (2026-11-17 · 배경 만들기 3단계 · 짝 = js/slide-bg-deco-panel.js · 설계 §5-1 · §5-4) ════════════════════════════
   줄 틀(.nq-bgm-row)을 쓰지 않는다 — 찾기 입력란 + 결과 그림 + 놓은 장식 목록이라 모양이 다르다(네 줄을 세는 시험도 그 이름으로 센다).
   누르는 대상은 모두 44px 이상. 고른 칸은 «겹 테두리 + ✓ 표»로 말한다(.nq-bgm-opt 와 같은 방식 · 색만으로 구분하지 않는다). */
.nq-bgd { margin: 0 0 8px; }
.nq-bgd-q { width: 100%; min-height: 44px; }
.nq-bgd-res { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-top: 6px; }
.nq-bgd-res:empty { display: none; }
.nq-bgd-pic {
  min-width: 44px; min-height: 44px; padding: 3px; cursor: pointer; font-family: inherit;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
  display: flex; align-items: center; justify-content: center;
}
.nq-bgd-pic img { max-width: 100%; max-height: 36px; object-fit: contain; pointer-events: none; }
.nq-bgd-pic:hover:not(:disabled) { background: var(--primary-light); }
.nq-bgd-pic:disabled { cursor: default; opacity: .45; }
.nq-bgd-pic:focus-visible, .nq-bgd-rm:focus-visible { outline: 3px solid var(--primary); outline-offset: 1px; }

.nq-bgd-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 6px 8px; align-items: center;
  margin-top: 8px; padding: 8px; border: 1px solid var(--border); border-radius: 8px;
}
.nq-bgd-th { grid-row: 1 / 3; width: 44px; height: 44px; object-fit: contain; }
.nq-bgd-seg { display: flex; gap: 6px; padding: 5px; margin: -5px; }   /* 고름 링(4px)이 잘리지 않게 안쪽 여백으로 둔다 */
.nq-bgd-at { grid-column: 2 / 4; }
.nq-bgd-sz { grid-column: 2; }
.nq-bgd-opt {
  position: relative; flex: 1; min-width: 0; min-height: 44px; padding: 4px 2px; cursor: pointer; font-family: inherit;
  font-size: var(--text-xs); font-weight: 700; line-height: 1.25; word-break: keep-all; color: var(--text-body);
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
}
.nq-bgd-opt:disabled { cursor: default; opacity: .45; }
.nq-bgd-opt[aria-checked="true"] { box-shadow: 0 0 0 1px var(--surface), 0 0 0 4px var(--primary); }   /* [design-ok] 고름 링 — .nq-bgm-opt 와 같은 겹 테두리(초점 outline 과 따로 그리는 링) */
.nq-bgd-opt[aria-checked="true"]::after {
  content: "✓"; position: absolute; right: 2px; bottom: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--primary-fill); color: var(--text-on-primary); font-size: var(--text-xs); font-weight: 800; line-height: 14px; text-align: center;
}
.nq-bgd-opt:focus-visible { outline: 2px solid var(--text-body); outline-offset: 2px; }
.nq-bgd-opt[aria-checked="true"]:focus-visible { outline-offset: 5px; }
.nq-bgd-rm {
  grid-column: 3; min-width: 44px; min-height: 44px; padding: 0 10px; cursor: pointer; font-family: inherit;
  font-size: var(--text-sm); font-weight: 700; color: var(--text-body);
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); white-space: nowrap;
}
.nq-bgd-rm:hover { background: var(--primary-light); }
.nq-bgd-warn { grid-column: 2 / 4; font-size: var(--text-sm); font-weight: 800; color: var(--warning-dark); word-break: keep-all; }

/* 편집 보기 무대 위 «글과 겹쳐요» 점선 — 선택 덧층(.qm-sel-ov)처럼 무대 카드 안 맨 끝에 얹고 눌러도 지나간다(js/slide-bg-deco-panel.js paintWarn).
   무대가 1280×720 을 줄여 보여 주므로 선 굵기는 배율로 되키운다. */
.qm-center-prev-card > .qm-deco-warn-layer { position: absolute; inset: 0; z-index: 99; pointer-events: none; }
.qm-deco-warn-layer > .qm-deco-warn {
  position: absolute; box-sizing: border-box; pointer-events: none;
  border: calc(3px / var(--alc-slide-scale, 1)) dashed var(--warning-dark); border-radius: calc(6px / var(--alc-slide-scale, 1));
}
