/* ==========================================================================
   sentence-workbook.css — 문장 가르치기 본 앱 화면 전용
   본 앱 workbook.css(.wbk-*)·nav.css(.nav-*)는 그대로 재사용.
   여기엔 단계탭(.swb-stage-*)·카테고리칩(.swb-cat-*)·권 헤더(.swb-book-*)
   ·문장 칩(.swb-chip)·미리보기 그림카드(.swb-pc-*) 등 문장 화면 추가분만.
   클래스 prefix .swb-* (sentence-workbook) — .wbk-*·.wb-*·.pc-* 와 격리.
   ========================================================================== */

/* ── 1단 단계 탭 바 — 본 앱 .wbk-age-bar 자리에 들어감 ─────────────── */
.swb-stage-bar {
  background: #fff;
  border-bottom: 1px solid var(--warm-border);
  position: sticky;
  top: 56px;
  z-index: 150;
}
.swb-stage-bar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.swb-stage-tab {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-mid);
  background: var(--sand-dark);
  cursor: default;
  transition: all 0.15s;
  border: 1.5px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.3;
  gap: 1px;
}
.swb-stage-tab:hover {
  background: var(--teal-light);
  color: var(--teal-dark);
}
.swb-stage-tab:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 2px;
}
.swb-stage-tab.is-menu-open:not(.active) {
  background: var(--teal-light);
  color: var(--teal-dark);
  border-color: rgba(15, 118, 110, 0.35);
}
.swb-stage-tab.active {
  background: var(--teal-dark);
  color: #fff;
  border-color: var(--teal-dark);
}
.swb-stage-tab.coming {
  opacity: 0.55;
}
.swb-stage-tab-label {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}
.swb-stage-tab-count {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.55;
  letter-spacing: -0.3px;
}
.swb-stage-tab.active .swb-stage-tab-count {
  opacity: 0.7;
}
.swb-stage-tab-meta {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.75;
}

/* 단계 하위 메뉴 — 데스크톱에서 단계 버튼은 메뉴 트리거, 실제 선택은 칩에서 확정 */
.swb-stage-menu {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 145;
  background: var(--sand);
  border-top: 1px solid rgba(231, 222, 207, 0.8);
  border-bottom: 1px solid var(--warm-border);
  box-shadow: 0 12px 24px rgba(35, 30, 24, 0.08);
  overflow: auto;
}
.swb-stage-menu[hidden] {
  display: none !important;
}
.swb-stage-menu-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 20px 16px;
}
.swb-stage-menu-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 4px 0;
}
.swb-stage-menu-row.is-unlabeled {
  grid-template-columns: minmax(0, 1fr);
}
.swb-stage-menu-label {
  color: #1e3a8a;
  font-size: 14px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}
.swb-stage-menu-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.swb-stage-menu-chip {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  min-height: 36px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--warm-border);
  background: #fff;
  color: var(--text-mid);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s, background 0.12s, color 0.12s, transform 0.12s;
}
.swb-stage-menu-chip:hover,
.swb-stage-menu-chip:focus-visible {
  background: #fafffd;
  border-color: var(--teal);
  color: var(--teal-dark);
  outline: none;
  transform: translateY(-1px);
}
.swb-stage-menu-chip.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.swb-stage-menu-chip.active .swb-chip-count {
  opacity: 0.85;
}
.swb-stage-menu-empty {
  color: var(--text-mid);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 0;
}

/* 2단 카테고리·3단 서술어 칩 카운트 — 라벨 옆 작은 보조 숫자 */
.swb-chip-count {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  opacity: 0.55;
  letter-spacing: -0.3px;
}
.swb-cat-chip.active .swb-chip-count,
.swb-predicate-chip.active .swb-chip-count {
  opacity: 0.85;
}

/* ── 2단 카테고리 칩 바 — 단계바 바로 아래 한 줄 ─────────────── */
/* UX 근거: 근접성(Proximity) — JS가 활성 1단 탭의 left 위치를 측정해서
   .swb-cat-bar-inner padding-left를 동적 조정. 클릭한 단계 탭 바로 아래에서
   카테고리 칩이 시작되어 시각적으로 묶임 (같은 기능의 버튼들이 모여 있음을
   위치로 표현). */
.swb-cat-bar {
  background: var(--sand);
  border-bottom: 1px solid var(--warm-border);
}
.swb-cat-bar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 20px;        /* padding-left는 JS가 동적 조정 */
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 50px;
  transition: padding-left 0.18s;
}
.swb-cat-chip {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;           /* 15 → 14 (살짝만 축소) */
  font-weight: 600;
  color: var(--text-dark);
  background: #fff;
  border: 1.5px solid var(--warm-border);
  cursor: pointer;
  transition: all 0.12s;
  user-select: none;
}
.swb-cat-chip:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}
/* 활성 절제 — solid 채움 X. 보더 강조 + 옅은 배경.
   1단(진한 solid)이 시각 무게에서 우세하도록. */
.swb-cat-chip.active {
  background: var(--teal-light);
  color: var(--teal-dark);
  border-color: var(--teal);
  border-width: 2px;
  padding: 7px 15px;         /* border 2px 늘어난 만큼 padding 보정 */
}
.swb-cat-bar-inner.swb-stage7-menu {
  display: block;
  padding: 12px 20px;
  min-height: 0;
  transition: none;
}
.swb-stage7-menu-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}
.swb-stage7-menu-label {
  color: #1e3a8a;
  font-size: 14px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}
.swb-stage7-menu-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.swb-stage7-book-chip {
  display: inline-flex;
  align-items: baseline;
  border-width: 1.5px;
}
@media (max-width: 780px) {
  .swb-stage7-menu-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }
  .swb-stage7-menu-label {
    text-align: left;
  }
}
.swb-cat-empty-msg {
  font-size: 14px;
  color: var(--text-mid);
  font-style: normal;
  padding-left: 4px;
}

/* ── 메인 영역 — 본 앱 .wbk-main 그대로지만 sticky top 보정 ────── */
.swb-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 20px 60px;
  display: grid;
  grid-template-columns: 52% 48%;
  gap: 24px;
  align-items: start;
}

/* 단계바만 sticky. 2단 카테고리바와 3단 서술어 필터는 본문과 함께 스크롤 */
.swb-word-panel-header {
  position: sticky;
  top: 114px;  /* 네비 56 + 단계바 ~58 */
  z-index: 100;
}
.swb-workbook-panel {
  position: sticky;
  top: 130px;
  height: calc(100vh - 150px);
}

/* 2단 바 숨김 (단계 미선택 또는 단계 준비 중) */
body.swb-no-cat .swb-cat-bar { display: none; }

@media (min-width: 781px) {
  #screen-sentence .swb-cat-bar,
  #screen-sentence .swb-predicate-filter {
    display: none !important;
  }
}

@media (max-width: 780px) {
  .swb-stage-menu {
    display: none !important;
  }
}

/* ── 좌측: 권 카드 + 그리드 체크리스트 (성장 기록 패턴 차용) ───── */
.swb-book-card {
  margin-bottom: 18px;
  background: #fff;
  border: 1px solid var(--warm-border);
  border-radius: 12px;
  padding: 14px 16px 10px;
}
.swb-book-card:last-child { margin-bottom: 0; }
.swb-book-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--warm-border);
  gap: 12px;
}
.swb-book-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
.swb-book-card .swb-book-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.2px;
}
.swb-book-card .swb-book-meta,
.swb-book-card .swb-book-patterns {
  font-size: 13px;
  color: var(--text-mid);
  font-weight: 500;
}
.swb-book-patterns {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
  line-height: 1.45;
}
.swb-pattern {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}
.swb-pattern-slot {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 1px 6px;
  border-radius: 6px;
  background: #f6f2ea;
  border: 1px solid #e3d9c8;
  color: #4f4638;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.swb-pattern-text {
  color: var(--text-mid);
  font-size: 13px;
  font-weight: 600;
  white-space: pre-wrap;
}
.swb-pattern-or {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f1f3f5;
  color: #68717a;
  font-size: 11px;
  font-weight: 800;
  margin: 0 3px;
  white-space: nowrap;
}
.swb-book-count {
  display: flex;
  align-items: baseline;
  gap: 1px;
  flex-shrink: 0;
  padding-top: 1px;
}
.swb-book-count-num {
  font-size: 18px;
  font-weight: 800;
  color: #1e3a8a;
}
.swb-book-count-sep {
  font-size: 14px;
  color: var(--text-mid);
  margin: 0 2px;
}
.swb-book-count-total {
  font-size: 14px;
  color: var(--text-mid);
  font-weight: 700;
}

/* 단계별 그리드 컬럼 — 문장 길이 따라 적정 폭 */
.swb-book-rows {
  display: grid;
  gap: 0 6px;
  padding: 2px 0;
}
.swb-book-rows[data-cols="5"] { grid-template-columns: repeat(5, 1fr); }
.swb-book-rows[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }
.swb-book-rows[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.swb-book-rows[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 980px) {
  .swb-book-rows[data-cols="5"] { grid-template-columns: repeat(4, 1fr); }
  .swb-book-rows[data-cols="4"] { grid-template-columns: repeat(3, 1fr); }
  .swb-book-rows[data-cols="3"] { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 780px) {
  .swb-book-rows[data-cols="5"] { grid-template-columns: repeat(3, 1fr); }
  .swb-book-rows[data-cols="4"] { grid-template-columns: repeat(2, 1fr); }
  .swb-book-rows[data-cols="3"] { grid-template-columns: 1fr; }
  .swb-book-rows[data-cols="2"] { grid-template-columns: 1fr; }
}

/* 단계 3+ 권 안 sub-그룹 — 변동축(밥·빵·과자 등)으로 분류. 행위자 × 변동 매트릭스 시각화.
   게슈탈트 근접성 — 같은 주제(같은 변동축) 행은 가까이, 주제 간 여백을 충분히. */
.swb-book-subgroup {
  margin-bottom: 22px;
}
.swb-book-subgroup:last-child { margin-bottom: 0; }
.swb-book-subgroup-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 6px 4px;
}
.swb-book-subgroup-label {
  font-size: 14px;
  font-weight: 700;
  color: #1e3a8a;
  margin: 0;
  letter-spacing: -0.2px;
}
.swb-bulk-add-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  min-height: 24px;
  padding: 3px 9px;
  border: 1.5px solid rgba(15, 118, 110, 0.36);
  border-radius: 999px;
  background: #fff;
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.12s;
}
.swb-bulk-add-chip:hover {
  background: #eef7f6;
  border-color: #0f9faf;
  transform: translateY(-1px);
}
.swb-bulk-add-chip.is-all-selected {
  background: #eef7f6;
  border-color: #0f766e;
  color: #0b5c56;
}
.swb-book-subgroup-pattern {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 600;
}
.swb-book-case-section {
  padding: 14px 0 4px;
  border-top: 1px solid rgba(15, 118, 110, 0.16);
}
.swb-book-case-section:first-child {
  padding-top: 2px;
  border-top: none;
}
.swb-book-case-section + .swb-book-case-section {
  margin-top: 18px;
}
.swb-book-case-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px 0;
}
.swb-book-case-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 12px;
  margin: 0;
  border-radius: 999px;
  background: #eef7f6;
  color: #0f766e;
  font-size: 14px;
  font-weight: 800;
}
.swb-book-case-pattern {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  color: var(--text-mid);
  font-size: 13px;
  font-weight: 600;
}
.swb-book-verb-group {
  margin-bottom: 16px;
}
.swb-book-verb-group .swb-book-subgroup-label {
  color: #1e3a8a;
}
.swb-stage6-book-card .swb-book-case-section {
  padding: 0;
  border-top: none;
}
.swb-stage6-book-card .swb-book-case-section + .swb-book-case-section {
  margin-top: 22px;
}
.swb-stage6-book-card .swb-book-verb-group {
  margin-bottom: 22px;
}
.swb-stage6-book-card .swb-book-verb-group:last-child {
  margin-bottom: 0;
}
.swb-stage6-book-card .swb-book-verb-group .swb-book-subgroup-label {
  color: #1e3a8a;
  margin: 0;
}

/* 체크 행 — 체크박스 + 문장 텍스트. 긴 문장은 셀 안 줄바꿈 */
.swb-checkrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-dark);
  transition: background 0.12s, color 0.12s;
  user-select: none;
  min-width: 0;
  min-height: 38px;
}
.swb-checkrow:hover { background: var(--sand); }
.swb-checkrow.is-checked {
  color: #1e3a8a;
  font-weight: 700;
  background: #f0f5ff;
}
.swb-checkrow.is-marquee-hover {
  background: rgba(8, 145, 178, 0.12);
}
.swb-checkrow input[type="checkbox"] {
  accent-color: var(--teal);
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.swb-checkrow-text {
  flex: 1;
  min-width: 0;
  word-break: keep-all;
  white-space: normal;
  line-height: 1.35;
}

/* ── "담은것만 보기" 모드 중 상단 컨트롤 비활성 (단어 학습지와 동일 패턴) ──
   토글(.wbk-selected-toggle)·안내 띠(.wbk-selected-banner)는 workbook.css 공유 */
body.swb-selected-only .swb-stage-bar,
body.swb-selected-only .swb-cat-bar,
body.swb-selected-only #swbPredicateFilter,
body.swb-selected-only #swbSearchBar,
body.swb-selected-only #swbAccordionActions {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.3);
}

/* ── 담은것만 보기: 단계(stage) 그룹 헤더 ── */
.swb-selected-stage + .swb-selected-stage { margin-top: 14px; }
.swb-selected-stage-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 4px 6px;
  margin-bottom: 4px;
  border-bottom: 1.5px solid var(--warm-border);
}
.swb-selected-stage-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--teal-dark);
}
.swb-selected-stage-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
}

/* ── 3단 서술어 필터 (단계 3+ 한정, 비sticky) ──────────────── */
.swb-predicate-filter {
  background: var(--sand);
  border-bottom: 1px solid var(--warm-border);
  padding: 10px 0;
}
.swb-predicate-filter[hidden] { display: none; }
.swb-predicate-group {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 4px 20px;
}
.swb-predicate-group-label {
  flex: 0 0 100px;
  font-size: 14px;
  font-weight: 700;
  color: #1e3a8a;
  text-align: right;
}
.swb-predicate-group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.swb-predicate-chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-mid);
  background: #fff;
  border: 1px solid var(--warm-border);
  cursor: pointer;
  transition: all 0.12s;
  user-select: none;
  white-space: nowrap;
}
.swb-predicate-chip:hover {
  color: var(--teal-dark);
  border-color: var(--teal);
}
.swb-predicate-chip.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

/* ── 활성 필터 라벨 (좌측 sticky 헤더) ───────────────────── */
.swb-active-filter-label {
  font-size: 12px;
  color: var(--text-mid);
  margin-top: 4px;
}
.swb-active-filter-label[hidden] { display: none; }
.swb-active-filter-label strong {
  color: var(--teal-dark);
  font-weight: 700;
}

/* ── 드래그 선택 marquee ─────────────────────────── */
/* 본문 컨테이너에 position: relative 부여 — marquee absolute 기준점 확보 */
#swbBookPanel { position: relative; }
.swb-marquee {
  position: absolute;
  pointer-events: none;
  background: rgba(8, 145, 178, 0.08);
  border: 1.5px solid rgba(8, 145, 178, 0.5);
  border-radius: 4px;
  z-index: 50;
}

/* ── 좌측: 권 헤더 + 칩 그리드 (이전 칩 방식, 시안 백업과 함께 보존) ── */
/* UX 근거: 시각 위계(Visual Hierarchy) — 큰 카테고리 그룹 > 권 이름 > 메타·카운트.
   글씨 크기·굵기 차등으로 정보 우선순위 표현. 명도 대비(Contrast) — 회색
   "안 보임" 피드백 받아 메타도 검정 톤으로 통일, 굵기로만 위계 구분. */
/* 그룹 타이틀 — 게슈탈트 공동 영역(common region) 원칙:
   구분선을 타이틀 위에 두고, 충분한 위 여백을 줘서 타이틀이 그 아래 권들과
   한 묶음으로 시각적으로 묶이게 함. 네이비 색상으로 권 이름(검정)과 위계 분리. */
.swb-book-group-title {
  font-size: 17px;             /* 권 이름 18보다 약간 작게 */
  font-weight: 700;
  color: #1e3a8a;              /* 네이비 (성장기록 강조색과 동일) */
  text-transform: none;
  letter-spacing: -0.3px;
  margin: 28px 0 14px;
  padding-top: 16px;
  border-top: 2px solid var(--warm-border);   /* 구분선을 위로 이동 */
}
.swb-book-group-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;            /* 첫 그룹은 위 라인 없이 깔끔하게 시작 */
}

.swb-book {
  margin-bottom: 22px;
}
.swb-book:last-child { margin-bottom: 0; }

.swb-book-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.swb-book-name {
  font-size: 16px;             /* 18 → 16 (그룹 17 보다 살짝 작게) */
  font-weight: 700;
  color: var(--text-dark);
}
.swb-book-meta {
  font-size: 14px;
  color: var(--text-mid);      /* 중간 회색 — 권 이름 강조 위계 회복 */
  font-weight: 500;
}
.swb-book-count {
  font-size: 14px;
  color: var(--text-mid);      /* 중간 회색 — 너무 흐린 light 아님 */
  font-weight: 500;
  margin-left: auto;
}

.swb-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 문장 칩 — 가변 폭, 한 줄 흐름 */
.swb-chip {
  padding: 7px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--warm-border);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.12s;
  user-select: none;
  white-space: nowrap;
  line-height: 1.3;
}
.swb-chip:hover {
  border-color: var(--teal-light);
  background: #fafffd;
  transform: translateY(-1px);
}
.swb-chip.checked {
  background: var(--teal-light);
  border-color: var(--teal);
  color: var(--teal-dark);
  font-weight: 700;
}

/* 빈 카테고리 안내 (단계 5·6 준비 중) */
.swb-coming-soon {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-light);
}
.swb-coming-soon-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.swb-coming-soon-icon img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  display: inline-block;
}
.swb-coming-soon-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 8px;
}
.swb-coming-soon-sub {
  font-size: 14px;
  color: var(--text-light);
}

/* ── 우측 워크북 패널 — 비활성 카드 (그림카드 외 회색) ────── */
.swb-wb-list-row.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.swb-wb-list-disabled-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-light);
  background: var(--sand-dark);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* ── 우측: 그림카드 미리보기 ────────────────────────────────── */
/* 페이지 경계 명확화 — sand-dark 배경 위에 흰 페이지가 또렷하게 떠 있는 구조.
   본 앱 .wbk-mock-pages + .wb-page-wrap 패턴 그대로. */
.swb-pc-pages-bg {
  background: var(--sand-dark);
  padding: 16px;
  border-radius: 12px;
}
.swb-pc-detail-body {
  padding: 0 24px 24px;
}
.swb-pc-page-wrap {
  width: 100%;
  margin-bottom: 16px;
  padding: 16px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  /* A4 가로 비율(297×210) 유지 — 카드 1장 추가해도 페이지 사이즈 변화 X.
     항상 한 장 단위로 추가되는 종이 한 장 느낌. */
  aspect-ratio: 297 / 210;
  display: flex;
  flex-direction: column;
}
.swb-pc-page-wrap:last-child { margin-bottom: 0; }

/* 그리드 2칸 × 3줄 고정. 짧은 카드=1칸, 긴 카드(.long)=2칸(전폭).
   클릭 순서를 보존하기 위해 중간 빈 슬롯을 유지하고, 남은 부족분만 placeholder가 채운다. */
.swb-pc-grid {
  display: grid;
  grid-auto-flow: row;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.swb-pc-card.long {
  grid-column: span 2;
}
.swb-pc-pages-bg.swb-layout-large2 .swb-pc-grid {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
}
.swb-pc-pages-bg.swb-layout-large2 .swb-pc-card.long {
  grid-column: span 1;
}
.swb-pc-pages-bg.swb-layout-large2 .swb-pc-card {
  padding: 8px 10px;
}
.swb-pc-pages-bg.swb-layout-large2 .swb-pc-card-empty {
  visibility: hidden;
}

/* 빈 슬롯 — 점선 박스로 "여기 카드 더 들어갈 자리" 시그널 */
.swb-pc-card-empty {
  border: 2px dashed #d4ccbe;
  background: #fafafa;
  border-radius: 10px;
  min-height: 0;
}

/* 그림카드 한 장 = 어휘 그림 + 조사 인라인 + 전체 문장 텍스트 */
.swb-pc-card {
  --swb-img-size: 64px;
  --swb-img-gap: 10px;
  --swb-negative-size: 50px;
  --swb-negative-stroke: 4px;
  background: #fff;
  border: 1.5px solid #ccc;
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  min-width: 0;
  box-sizing: border-box;
}
.swb-pc-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--swb-img-gap);
  flex-wrap: nowrap;
  width: 100%;
  min-width: 0;
}
/* 어휘 미니박스 — 단어 경계 시각화. 보더 1px 만으로 이미지를 감쌈(패딩 X).
   페이지 A4 비율 + 그리드 고정이라 박스에 padding 더하면 카드 가로/세로 overflow.
   조사는 박스 사이 인라인 텍스트로 자연 흐름. */
.swb-pc-img-box {
  position: relative;
  flex: 0 0 auto;
  width: var(--swb-img-size);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0;
  border: 1px solid #d8cfbe;
  border-radius: 6px;
  overflow: hidden;
}
.swb-pc-img {
  width: var(--swb-img-size);
  height: var(--swb-img-size);
  object-fit: contain;
  background: #fff;
}
.swb-pc-img-label {
  font-size: 12px;
  color: var(--text-dark);   /* 회색 → 검정 */
  font-weight: 600;
}
.swb-pc-img-fallback {
  width: var(--swb-img-size);
  height: var(--swb-img-size);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border: 1px dashed #c0b8a9;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #8a8275;
  font-size: 12px;
}

/* 조사·어미 인라인 텍스트 — 그림 사이/뒤에 흐름. 글자가 세로로 끊기지 않게 nowrap */
.swb-pc-inline {
  font-size: 16px;
  font-weight: 600;
  color: #444;
  padding: 0 2px;
  margin-top: -18px;  /* 그림 라벨 자리 보정 — 조사를 그림 옆 시각적 중앙으로 */
  align-self: center;
  white-space: nowrap;
}
.swb-pc-card.long .swb-pc-inline {
  font-size: 18px;
  margin-top: -22px;
}
.swb-pc-negative-mark {
  position: absolute;
  top: calc((var(--swb-img-size) - var(--swb-negative-size)) / 2);
  left: calc((var(--swb-img-size) - var(--swb-negative-size)) / 2);
  width: var(--swb-negative-size);
  height: var(--swb-negative-size);
  border: var(--swb-negative-stroke) solid rgba(215, 53, 53, 0.72);
  border-radius: 999px;
  pointer-events: none;
}
.swb-pc-negative-mark::after {
  content: "";
  position: absolute;
  top: calc((var(--swb-negative-size) - var(--swb-negative-stroke)) / 2);
  left: calc(var(--swb-negative-size) * 0.08);
  width: calc(var(--swb-negative-size) * 0.84);
  height: var(--swb-negative-stroke);
  border-radius: 999px;
  background: rgba(215, 53, 53, 0.72);
  transform: rotate(-35deg);
  transform-origin: center;
}

/* 전체 문장 텍스트 (반말) */
.swb-pc-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.2px;
  margin-top: 4px;
}
.swb-pc-grid.layout-6 .swb-pc-text {
  font-size: 13px;
}

/* 글자 표시 ON/OFF 체크박스 (헤더 우측, 순서 섞기 옆).
   .wbk-wb-detail-title 가 flex:1 이라 자연스럽게 우측 정렬됨. */
.swb-layout-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(56px, 1fr));
  overflow: hidden;
  border: 1px solid var(--warm-border);
  border-radius: 8px;
  background: #fff;
  flex-shrink: 0;
}
.swb-layout-switch button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--warm-border);
  background: transparent;
  color: var(--text-mid);
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}
.swb-layout-switch button:last-child {
  border-right: 0;
}
.swb-layout-switch button.active {
  background: var(--teal-dark);
  color: #fff;
}
.swb-layout-switch button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: -3px;
}
.swb-toggle-labels {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  cursor: pointer;
  user-select: none;
  margin: 0 4px;
  padding: 6px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}
.swb-toggle-labels:hover { background: var(--sand-dark); }
.swb-toggle-labels input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--teal);
  margin: 0;
}

/* 글자 숨김 모드 — 그림 라벨 + 문법(가/에서/으로) 인라인 모두 숨김.
   짧은 카드는 그림 약간 ↑ (라벨 자리 회수). 긴 카드는 그대로 — 그림 4-5장이
   가로 한 줄에 들어가야 하므로 더 키우면 overflow. */
.swb-no-labels .swb-pc-img-label,
.swb-no-labels .swb-pc-inline {
  display: none;
}
.swb-no-labels .swb-pc-card:not(.long) {
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 4px;
  padding-right: 4px;
}

/* "+" 안내 카드 — 페이지 그리드 외부, 항상 하단에 위치 (빈 상태에선 단독).
   본 앱 .wb-add-slot 패턴과 동일 — "더 담을 수 있어요" 시그널만 (실 슬롯 X). */
.swb-pc-add-slot {
  margin-top: 18px;
  padding: 36px 20px;
  border: 2px dashed #c8bfb0;
  border-radius: 12px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}
/* 빈 상태 — add-slot이 컨테이너 첫(유일) 자식일 때 위 margin 제거 */
.swb-pc-pages-bg > .swb-pc-add-slot:first-child {
  margin-top: 0;
}
.swb-pc-add-icon {
  font-size: 40px;
  font-weight: 300;
  color: #a8a09a;
  line-height: 1;
}
.swb-pc-add-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-mid);
}
.swb-pc-add-sub {
  font-size: 12px;
  color: var(--text-light);
}

/* ── 미리보기 비어있음 ─────────────────────────────── */
.swb-pc-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.swb-pc-empty-icon { font-size: 36px; margin-bottom: 12px; }
.swb-pc-empty-text { font-size: 15px; font-weight: 600; color: var(--text-mid); }

#swbPrintRoot {
  display: none;
}

/* ==========================================================================
   인쇄 — A4 가로(landscape). body.swb-print-active 일 때만 적용.
   chrome(네비·필터·왼쪽 문장 풀·헤더·안내·빈 슬롯 보더) 전부 숨김 →
   .swb-pc-page-wrap 만 297×210mm 페이지로 출력.
   ========================================================================== */
@media print {
  body.swb-print-active {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.swb-print-active > :not(#swbPrintRoot) {
    display: none !important;
  }
  body.swb-print-active #swbPrintRoot {
    display: block !important;
  }

  /* chrome 전부 숨김 */
  body.swb-print-active .nav-bar,
  body.swb-print-active .swb-stage-bar,
  body.swb-print-active .swb-stage-menu,
  body.swb-print-active .swb-cat-bar,
  body.swb-print-active .swb-predicate-filter,
  body.swb-print-active .wbk-word-panel,
  body.swb-print-active .wbk-wb-detail-bar,
  body.swb-print-active .swb-pc-add-slot,
  body.swb-print-active .swb-pc-empty,
  body.swb-print-active .wbk-blank-notice,
  body.swb-print-active .swb-blank-notice { display: none !important; }

  /* 컨테이너 — flex/grid 해제, 일반 흐름으로 */
  body.swb-print-active .swb-main,
  body.swb-print-active .wbk-workbook-panel,
  body.swb-print-active .wbk-wb-detail,
  body.swb-print-active .wbk-wb-detail-body {
    display: block !important;
    position: static !important;
    top: auto !important;
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    box-shadow: none !important;
  }

  body.swb-print-active .swb-pc-pages-bg {
    background: #fff !important;
    padding: 0 !important;
    border-radius: 0 !important;
  }
  body.swb-print-active .swb-pc-detail-body {
    padding: 0 !important;
  }

  /* 페이지 — A4 가로 297×210mm 고정. aspect-ratio 해제 */
  body.swb-print-active .swb-pc-page-wrap {
    aspect-ratio: auto !important;
    width: 297mm !important;
    height: 210mm !important;
    margin: 0 !important;
    padding: 6mm !important;
    background: #fff !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
    page-break-after: always !important;
    page-break-inside: avoid !important;
    overflow: hidden !important;
  }
  body.swb-print-active .swb-pc-grid {
    gap: 3mm !important;
  }
  body.swb-print-active #swbPrintRoot .swb-pc-pages-bg.swb-layout-large2 .swb-pc-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
  }
  body.swb-print-active #swbPrintRoot .swb-pc-pages-bg.swb-layout-large2 .swb-pc-card.long {
    grid-column: span 1 !important;
  }
  body.swb-print-active .swb-pc-page-wrap:last-child,
  body.swb-print-active .swb-pc-page-wrap:has(+ .swb-pc-add-slot) {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  /* 빈 슬롯은 공간 유지하되 보더·내용 안 보이게 */
  body.swb-print-active .swb-pc-card-empty { visibility: hidden !important; }

  /* 카드 내부 — 페이지 padding 6mm 적용 후 셀 ~141×64mm(짧은) / 285×64mm(긴).
     화면 px(64-72) 그대로면 인쇄 시 19mm 밖에 안 됨 → mm 단위 override */
  body.swb-print-active .swb-pc-card {
    padding: 3mm 4mm !important;
    gap: 2mm !important;
    border-width: 1.5px !important;
  }
  body.swb-print-active .swb-pc-row {
    gap: var(--swb-img-gap) !important;
    justify-content: space-evenly !important;
  }
  body.swb-print-active .swb-no-labels .swb-pc-card:not(.long) .swb-pc-row {
    gap: var(--swb-img-gap) !important;
    justify-content: center !important;
  }
  body.swb-print-active .swb-pc-img-box {
    width: var(--swb-img-size) !important;
    padding: 0 !important;
    border-width: 1px !important;
  }
  body.swb-print-active .swb-pc-img,
  body.swb-print-active .swb-pc-img-fallback {
    width: var(--swb-img-size) !important;
    height: var(--swb-img-size) !important;
  }
  body.swb-print-active .swb-pc-img-label {
    font-size: 11pt !important;
  }
  body.swb-print-active .swb-pc-inline {
    font-size: 14pt !important;
    margin-top: -3mm !important;
  }
  body.swb-print-active .swb-pc-card.long .swb-pc-inline {
    font-size: 13pt !important;
    margin-top: -2mm !important;
  }
  body.swb-print-active .swb-pc-negative-mark {
    top: calc((var(--swb-img-size) - var(--swb-negative-size)) / 2) !important;
    left: calc((var(--swb-img-size) - var(--swb-negative-size)) / 2) !important;
    width: var(--swb-negative-size) !important;
    height: var(--swb-negative-size) !important;
    border-width: var(--swb-negative-stroke) !important;
  }
  body.swb-print-active .swb-pc-negative-mark::after {
    top: calc((var(--swb-negative-size) - var(--swb-negative-stroke)) / 2) !important;
    left: calc(var(--swb-negative-size) * 0.08) !important;
    width: calc(var(--swb-negative-size) * 0.84) !important;
    height: var(--swb-negative-stroke) !important;
  }
  body.swb-print-active .swb-pc-text {
    font-size: 14pt !important;
    margin-top: 2mm !important;
  }

  /* 색·이미지 인쇄 강제 */
  body.swb-print-active * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* @page landscape — JS 가 인쇄 시 동적 주입(<style id="swb-print-style">).
   다른 화면에서 portrait 인쇄 영향 안 주게 분리. */


/* ==========================================================================
   검색 (sentence-workbook-search) — 데스크톱 검색바 + 책별 그루핑 결과
   ========================================================================== */
.swb-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--sand-dark);
  border: 1px solid #D8CFBE;
  border-radius: 10px;
  padding: 8px 12px;
  margin-top: 10px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.swb-search-bar:focus-within {
  background: #fff;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8,145,178,0.12);
}
.swb-search-icon { font-size: 14px; color: var(--text-mid); opacity: 0.7; }
.swb-search-bar .swb-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-dark);
  min-width: 0;
}
.swb-search-bar .swb-search-input::placeholder { color: var(--text-mid); }
.swb-search-bar .swb-search-clear {
  border: none;
  background: rgba(0,0,0,0.06);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--text-mid);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.swb-search-bar .swb-search-clear:hover { background: rgba(0,0,0,0.12); }

/* 결과 메타 (v2 — 모두 접기/펼치기 버튼 포함) */
.swb-search-meta {
  position: sticky;
  top: var(--swb-search-meta-top, 230px);
  z-index: 90;
  font-size: 13px;
  color: var(--text-mid);
  padding: 8px 0 12px;
  background: #fff;
  border-bottom: 1px solid var(--warm-border);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: 0 8px 14px rgba(255, 255, 255, 0.9);
}
.swb-search-meta strong { color: var(--teal-dark); font-weight: 800; }
.swb-search-meta-text { flex: 1; min-width: 0; }
.swb-search-bulk-toggles {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}
.swb-search-bulk-toggles button {
  background: #fff;
  border: 1px solid var(--warm-border);
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}
.swb-search-bulk-toggles button:hover:not(:disabled) {
  background: var(--sand-dark);
  color: var(--text-dark);
}
.swb-search-bulk-toggles button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 책별 그룹 — 아코디언 */
.swb-search-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.swb-search-group {
  background: #fff;
  border: 1px solid var(--warm-border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.swb-search-group.is-open {
  border-color: var(--teal);
}

.swb-search-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--sand);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: background 0.12s;
}
.swb-search-group.is-open .swb-search-group-header {
  border-bottom-color: var(--warm-border);
}
.swb-search-group-header:hover { background: #F1ECE0; }

.swb-search-group-caret {
  width: 16px;
  text-align: center;
  font-size: 11px;
  color: var(--text-mid);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.swb-search-group.is-open .swb-search-group-caret { transform: rotate(90deg); }

.swb-search-group-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-dark);
  flex-shrink: 0;
}
.swb-search-group-stage {
  font-size: 11px;
  font-weight: 700;
  color: var(--teal-dark);
  background: var(--teal-light);
  padding: 2px 8px;
  border-radius: 5px;
  flex-shrink: 0;
  white-space: nowrap;
}
.swb-search-group-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-mid);
  flex-shrink: 0;
}
.swb-search-group-preview {
  flex: 1;
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.swb-search-group-spacer { flex: 1; }

.swb-search-bulk-add {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--emerald);
  background: #fff;
  color: var(--emerald-dark);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.swb-search-bulk-add:hover:not(:disabled) { background: var(--emerald-light); }
.swb-search-bulk-add.is-all-added {
  background: #fff;
  border-color: #D84848;
  color: #D84848;
}
.swb-search-bulk-add.is-all-added:hover { background: rgba(216,72,72,0.06); }
.swb-search-bulk-add:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: var(--warm-border);
  color: var(--text-light);
}

.swb-search-group-body {
  display: none;
  flex-direction: column;
}
.swb-search-group.is-open .swb-search-group-body { display: flex; }

.swb-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--sand-dark);
  font-family: inherit;
  transition: background 0.12s;
}
.swb-search-row:last-child { border-bottom: none; }
.swb-search-row:hover { background: #F8FCFC; }
.swb-search-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--emerald);
  flex-shrink: 0;
  cursor: pointer;
}
.swb-search-row.is-checked { background: var(--emerald-light); }
.swb-search-row.is-checked:hover { background: var(--emerald-light); }
.swb-search-row-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.5;
}
.swb-search-mark {
  background: #FEF3C7;
  color: #92400E;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 800;
}

/* 빈 상태 */
.swb-search-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-mid);
}
.swb-search-empty-icon { font-size: 40px; margin-bottom: 12px; }
.swb-search-empty-title { font-size: 15px; font-weight: 700; color: var(--text-dark); margin-bottom: 4px; }
.swb-search-empty-sub { font-size: 13px; color: var(--text-light); }

/* 인라인 토스트 */
.swb-search-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 1000;
  padding: 12px 18px;
  background: #1F2937;
  color: #fff;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.22s, transform 0.22s;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  pointer-events: none;
  max-width: 90vw;
}
.swb-search-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
