.wiki-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 24px 18px;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface);
}

.brand {
  display: block;
  margin-bottom: 14px;
  font-weight: 700;
  text-decoration: none;
}

.search-trigger {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-btn);
  background: var(--color-surface-alt);
  color: var(--color-text-primary);
  font: inherit;
  cursor: pointer;
}

.nav-course {
  margin-top: 28px;
}

.nav-course:first-child {
  margin-top: 8px;
}

.nav-course-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 0 0 4px;
  color: var(--color-text-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--color-border, rgba(0, 0, 0, 0.08));
  cursor: pointer;
  list-style: none;
  user-select: none;
}

/* 네이티브 disclosure 마커 제거(크로스브라우저) → 커스텀 셰브론만 노출 */
.nav-course-label::-webkit-details-marker {
  display: none;
}

.nav-course-label::marker {
  content: "";
}

/* 셰브론(왼쪽): 접힘=오른쪽(▶), 펼침=아래(▼) */
.nav-course-label::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  margin-top: -2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  opacity: 0.6;
}

.nav-course[open] > .nav-course-label::before {
  transform: rotate(45deg);
  margin-top: 0;
}

.nav-course .nav-group {
  margin-top: 14px;
}

.nav-group {
  margin-top: 22px;
}

.nav-group h2 {
  margin: 0 0 8px;
  color: var(--color-text-muted);
  font-size: 13px;
}

.nav-link {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 9px 10px;
  border-radius: var(--radius-card);
  text-decoration: none;
}

.nav-link:hover,
.nav-link.is-active {
  background: var(--color-surface-hover);
}

.nav-link span,
.eyebrow {
  color: var(--color-teal);
  font: 700 13px/1.4 var(--font-mono);
}

.nav-link strong {
  font-size: 14px;
  font-weight: 500;
}

.content {
  width: min(920px, calc(100vw - 360px));
  margin: 0 auto;
  padding: 56px 32px 96px;
}

.content h1 {
  margin: 0 0 20px;
  font-size: 34px;
  line-height: 1.25;
  letter-spacing: 0;
}

.content h2 {
  margin: 36px 0 12px;
  font-size: 20px;
  line-height: 1.35;
  letter-spacing: 0;
}

.lead-block,
.definition {
  font-size: 20px;
  line-height: 1.65;
  color: var(--color-text-primary);
}

.concept-link {
  color: var(--color-teal);
  font-weight: 700;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.module-badge,
.concept-chip,
.needs-work {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.needs-work {
  width: fit-content;
  border-color: #fecdd3;
  background: var(--color-coral-bg);
  color: var(--color-coral);
}

.refs,
.backlinks {
  padding-left: 20px;
}

.refs li {
  margin-bottom: 14px;
}

.refs span,
.empty-note {
  display: block;
  color: var(--color-text-muted);
  font-size: 13px;
}

.svg-slot {
  display: grid;
  place-items: center;
  margin: 28px 0;
  padding: 28px;
  border: 1px dashed var(--color-border-hover);
  border-radius: var(--radius-card);
  background: var(--color-surface);
}

.concept-diagram {
  margin: 28px 0;
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  text-align: center;
}

.concept-diagram svg {
  width: 100%;
  max-width: 460px;
  height: auto;
}

.concept-diagram figcaption {
  margin-top: 12px;
  color: var(--color-text-muted);
  font-size: 13px;
}

.index-group {
  margin-top: 36px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.module-card {
  min-height: 168px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  text-decoration: none;
}

.module-card span {
  color: var(--color-teal);
  font-family: var(--font-mono);
  font-weight: 700;
}

.module-card strong {
  display: block;
  margin: 8px 0;
  font-size: 17px;
}

.module-card p {
  margin: 0;
  color: var(--color-text-body);
}

/* 개념 키워드 미리보기 카드 — 누른 단어 옆에 뜨는 가벼운 팝오버.
   본문을 가리지 않고 한 줄 정의만 보여주며, '전체 페이지 보기'로 승격한다.
   좁은 화면(<=640px)에서는 하단 시트로 전환(아래 미디어쿼리). */
.concept-card {
  position: fixed;
  z-index: 40;
  width: min(320px, calc(100vw - 28px));
  max-height: min(60vh, 380px);
  overflow: auto;
  padding: 15px 16px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgb(28 25 23 / 14%);
}

.concept-card[hidden],
.concept-card-scrim[hidden],
.command-palette[hidden] {
  display: none;
}

/* 스크림은 바깥 클릭 닫기 전용(투명) — 본문은 그대로 보인다. */
.concept-card-scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: transparent;
}

.concept-card-close {
  position: absolute;
  top: 8px;
  right: 9px;
  border: 0;
  background: none;
  color: var(--color-text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}

.concept-card-close:hover {
  color: var(--color-text-primary);
}

.concept-card-title {
  margin: 0 24px 6px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.concept-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 9px;
}

.concept-card-badges:empty {
  display: none;
}

.concept-card-badges a {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-teal);
  background: var(--color-teal-bg);
  border: 1px solid #99f6e4;
  border-radius: 6px;
  padding: 1px 7px;
  text-decoration: none;
}

/* 개념도 썸네일 — 개념 페이지의 SVG 다이어그램을 작게(있는 개념만). */
.concept-card-thumb {
  margin-bottom: 11px;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  overflow: hidden;
}

.concept-card-thumb[hidden] {
  display: none;
}

.concept-card-thumb svg {
  display: block;
  width: 100%;
  height: auto;
}

.concept-card-def {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--color-text-body);
  margin-bottom: 12px;
}

.concept-card-def p {
  margin: 0 0 8px;
}

.concept-card-def p:last-child {
  margin-bottom: 0;
}

.concept-card-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-link);
  text-decoration: none;
}

.concept-card-more:hover {
  text-decoration: underline;
}

/* 미리보기 카드 → '전체 페이지 보기'를 누르면 그 자리서 전체 패널(모달)로 펼침.
   페이지 이동이 없으니, 닫으면 읽던 설명 섹션 그 자리로 즉시 복귀한다. */
.concept-card-peek[hidden],
.concept-card-full[hidden] {
  display: none;
}

.concept-card.is-expanded {
  left: 50% !important;
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%);
  z-index: 60;
  width: min(720px, calc(100vw - 32px));
  max-height: 86vh;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.concept-card.is-expanded .concept-card-close {
  top: 12px;
  right: 14px;
  z-index: 2;
  font-size: 22px;
}

.concept-card-scrim.is-modal {
  z-index: 55;
  background: rgb(28 25 23 / 45%);
}

.concept-card-full {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.concept-card-newtab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  margin: 14px 0 -4px 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-link);
  text-decoration: none;
}

.concept-card-newtab:hover {
  text-decoration: underline;
}

/* 패널 본문 — .content의 페이지용 너비/여백을 패널 크기로 덮어쓴다(헤딩·정의·뱃지 스타일은 유지). */
.concept-card-full-body {
  flex: 1 1 auto;
  min-height: 0;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 12px 28px 28px;
  overflow: auto;
}

@media (max-width: 640px) {
  /* 좁은 화면: 전체 펼침도 하단 시트로(데스크톱 가운데 정렬 !important를 되돌린다). */
  .concept-card.is-expanded {
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    transform: none;
    width: 100%;
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
    padding: 0;
  }
  .concept-card-full-body {
    padding: 10px 20px 24px;
  }
}

/* 인라인 키워드 링크에 '미리보기 있음' 어포던스 */
.content a[href*="/c/"] {
  text-underline-offset: 2px;
}

@media (max-width: 640px) {
  /* 좁은 화면: 하단 시트로 전환. JS의 인라인 left/top은 미디어쿼리가 덮어쓴다. */
  .concept-card {
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    width: 100%;
    max-height: 72vh;
    border-radius: 16px 16px 0 0;
    padding: 18px 20px 24px;
    box-shadow: 0 -16px 50px rgb(28 25 23 / 18%);
    animation: card-sheet-up 0.22s ease;
  }
  .concept-card-scrim {
    background: rgb(28 25 23 / 18%);
  }
  @keyframes card-sheet-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: start center;
  padding-top: 12vh;
  background: rgb(28 25 23 / 28%);
}

.palette-box {
  width: min(640px, calc(100vw - 32px));
  max-height: 70vh;
  overflow: auto;
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-panel);
}

[data-search-input] {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  font: inherit;
}

.search-result {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
}

.search-result span {
  display: block;
  color: var(--color-text-muted);
  font-size: 13px;
}

@media (max-width: 820px) {
  .wiki-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    max-height: 50vh;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }

  .content {
    width: 100%;
    padding: 32px 18px 72px;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }
}

/* 교안 우선(deck-first) 레이아웃 */
.deck-body {
  overflow: hidden;
}

.deck-shell {
  position: relative;
  /* 드로어와 동일한 모바일 100vh 문제: 동적 뷰포트(dvh)로 실제 보이는 높이에 맞춤 */
  height: calc(100vh - var(--deck-nav-h, 60px));
  height: calc(100dvh - var(--deck-nav-h, 60px));
  display: flex;
  flex-direction: column;
}

.deck-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px clamp(16px, 4vw, 56px) 18px;
}

.deck-topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.deck-topbar-title h1.deck-title {
  margin: 2px 0 0;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.25;
}

/* 모듈 ID를 제목 줄에 인라인 배지로(별도 eyebrow 줄 제거 → 슬라이드 영역 확대) */
.deck-id-badge {
  display: inline-block;
  vertical-align: middle;
  margin-right: 10px;
  transform: translateY(-2px);
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #99f6e4;
  background: var(--color-teal-bg);
  color: var(--color-teal);
  font: 700 12px/1 var(--font-mono);
}

.deck-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.deck-notes-btn,
.deck-newtab {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.deck-notes-btn {
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text-primary);
}

.deck-notes-btn:hover {
  background: var(--color-surface-hover);
}

.deck-newtab {
  border: 1px solid var(--color-teal);
  background: var(--color-teal);
  color: var(--color-surface);
}

.deck-newtab:hover {
  background: #0b5d56;
}

/* 원본 슬라이드 새 탭 보조 링크(전체화면 버튼이 인페이지 풀스크린을 맡으면서 추가) */
.deck-newtab-alt {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-teal);
  text-decoration: none;
}
.deck-newtab-alt:hover { text-decoration: underline; }

.deck-frame-wrap {
  position: relative;            /* 인페이지 풀스크린 시 필기 캔버스(absolute)의 기준 */
  flex: 1;
  min-height: 360px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow-panel);
}
.deck-frame-wrap:fullscreen {
  border: 0;
  border-radius: 0;
}

.deck-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.edge-handle {
  position: absolute;
  top: 106px;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 7px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-panel);
  cursor: pointer;
}

.edge-handle:hover {
  background: var(--color-surface-hover);
}

.edge-handle-left {
  left: 0;
  border-left: 0;
  border-radius: 0 12px 12px 0;
}

.edge-handle-right {
  right: 0;
  border-right: 0;
  border-radius: 12px 0 0 12px;
}

.edge-handle-label {
  writing-mode: vertical-rl;
  letter-spacing: 2px;
  font-size: 14px;
  font-weight: 700;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgb(28 25 23 / 28%);
}

.drawer-backdrop[hidden] {
  display: none;
}

.toc-drawer,
.notes-drawer {
  position: absolute;
  top: 0;
  /* 100vh 는 모바일/태블릿에서 주소창을 뺀 '큰' 뷰포트라 드로어가 화면보다 길어진다
     → 마지막 코스(티처메이트 이용법)가 브라우저 UI 뒤에 갇혀 스크롤로 못 닿음.
     dvh(동적 뷰포트)로 실제 보이는 높이에 맞춰 끝까지 스크롤되게 한다. */
  height: 100vh;
  height: 100dvh;
  overflow: auto;
  background: var(--color-surface);
  box-shadow: var(--shadow-panel);
}

.toc-drawer {
  left: 0;
  width: min(320px, 86vw);
  padding: 22px 16px;
}

.notes-drawer {
  right: 0;
  width: min(560px, 94vw);
  padding: 24px 26px 64px;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.drawer-head .brand {
  margin: 0;
}

.drawer-crumb {
  margin: 0;
  color: var(--color-text-muted);
  font: 700 13px/1.4 var(--font-mono);
}

[data-toc-close],
[data-notes-close] {
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-btn);
  background: var(--color-surface-alt);
  color: var(--color-text-primary);
  font: inherit;
  cursor: pointer;
}

.toc-drawer .search-trigger {
  margin-bottom: 8px;
}

.notes-drawer .content {
  width: auto;
  padding: 0;
}

.notes-drawer .lead-block,
.notes-drawer .content h2:first-child {
  margin-top: 0;
}

@media (max-width: 820px) {
  .deck-shell {
    height: calc(100vh - var(--deck-nav-h, 52px));
    height: calc(100dvh - var(--deck-nav-h, 52px));
  }

  .deck-main {
    padding: 12px 14px 16px;
  }

  .deck-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .edge-handle {
    top: 150px;
  }
}

/* ── 마우스 필기 v2 (펜 3색·굵기 / 텍스트 박스 / 지우개 / 되돌리기) 오버레이 ──────
   전 페이지 공통. 잉크·텍스트는 콘텐츠 좌표(document)에 그려져 스크롤을 따라온다.
   평소엔 캔버스가 pointer-events:none이라 페이지를 안 가리고, '필기' 토글을 켰을 때만
   화면을 덮어 입력을 받는다. 새로고침 시 휘발(저장 없음). */
.annot-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2147482000;
  pointer-events: none;   /* 비활성: 클릭이 그대로 페이지로 통과 */
  touch-action: none;
}
body.annot-active .annot-canvas { pointer-events: auto; cursor: crosshair; }
body.annot-active.annot-text .annot-canvas { cursor: text; }
/* 인페이지 풀스크린 동안엔 fixed→absolute 로 전환해 풀스크린 요소 안에서도 필기 가능 */
.annot-canvas.in-fs,
.annot-bar.in-fs,
.annot-text-layer.in-fs { position: absolute; }

/* 텍스트 주석 레이어 — fixed(뷰포트 기준)이고, 각 박스가 호스트 스크롤만큼 transform 돼 콘텐츠를 추종 */
.annot-text-layer {
  position: fixed; inset: 0 auto auto 0; width: 100%; height: 0;
  z-index: 2147482500; pointer-events: none;
}

/* PPT식 텍스트 박스: 선택 시 테두리+8핸들로 이동·리사이즈, 더블클릭 편집, ×/지우개/Delete 삭제 */
.annot-text-box { position: absolute; width: 200px; box-sizing: border-box; pointer-events: none; transition: box-shadow .08s ease; }
/* 박스는 텍스트·지우개 모드에서만 입력을 받음(펜 모드에선 위로 그릴 수 있게 통과) */
body.annot-text .annot-text-box,
body.annot-eraser .annot-text-box { pointer-events: auto; }
body.annot-eraser .annot-text-box { cursor: cell; }
.annot-text-item {
  width: 100%; min-height: 1.45em; box-sizing: border-box;
  font: 600 17px/1.45 inherit; color: #0f172a; white-space: pre-wrap; word-break: break-word;
  padding: 2px 4px; border-radius: 3px; outline: none;
}
/* hover 인터랙션 — 마우스 올리면 "선택 가능/삭제 대상"임을 즉시 알려줌 */
body.annot-text .annot-text-box:not(.editing):not(.selected):hover { cursor: move; }
body.annot-text .annot-text-box:not(.editing):not(.selected):hover .annot-text-item { box-shadow: 0 0 0 1px #94a3b8; background: rgba(148, 163, 184, .12); }
body.annot-eraser .annot-text-box:hover .annot-text-item { box-shadow: 0 0 0 1.5px #e11d48; background: rgba(225, 29, 72, .10); }
.annot-text-box.selected { cursor: move; }
.annot-text-box.selected .annot-text-item { box-shadow: 0 0 0 1px #64748b; }
.annot-text-box.editing .annot-text-item { cursor: text; background: rgba(255, 255, 255, .92); box-shadow: 0 0 0 2px #334155; }
.annot-text-item.empty::before { content: "여기에 입력…"; color: #94a3b8; }

/* 리사이즈 핸들(선택 시) */
.annot-handle { position: absolute; width: 10px; height: 10px; background: #fff; border: 1.5px solid #334155; border-radius: 2px; z-index: 5; display: none; }
.annot-text-box.selected .annot-handle { display: block; }
.annot-handle[data-h="nw"] { left: -5px; top: -5px; cursor: nwse-resize; }
.annot-handle[data-h="n"] { left: calc(50% - 5px); top: -5px; cursor: ns-resize; }
.annot-handle[data-h="ne"] { right: -5px; top: -5px; cursor: nesw-resize; }
.annot-handle[data-h="e"] { right: -5px; top: calc(50% - 5px); cursor: ew-resize; }
.annot-handle[data-h="se"] { right: -5px; bottom: -5px; cursor: nwse-resize; }
.annot-handle[data-h="s"] { left: calc(50% - 5px); bottom: -5px; cursor: ns-resize; }
.annot-handle[data-h="sw"] { left: -5px; bottom: -5px; cursor: nesw-resize; }
.annot-handle[data-h="w"] { left: -5px; top: calc(50% - 5px); cursor: ew-resize; }

/* 삭제 × 버튼(선택 시) */
.annot-del {
  position: absolute; top: -13px; right: -13px; width: 22px; height: 22px; border-radius: 50%;
  background: #e11d48; color: #fff; border: 2px solid #fff; font-size: 13px; line-height: 1; cursor: pointer; display: none; padding: 0; z-index: 6;
}
.annot-text-box.selected .annot-del { display: block; }

/* 툴바 */
.annot-bar {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2147483000;    /* 캔버스보다 위 → 그리는 중에도 버튼 클릭 가능 */
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px;
  border-radius: 999px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.16);
  font-family: inherit;
  flex-wrap: wrap;
  max-width: calc(100vw - 32px);
  justify-content: flex-end;
}
.annot-bar button {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  color: var(--text, #0f172a);
  white-space: nowrap;
}
/* hover/활성 배경은 스와치엔 적용 안 함(:not(.swatch)) — 스와치 색이 바뀌면 안 됨 */
.annot-bar button:hover:not(.swatch) { background: var(--surface-muted, #f1f5f9); }
/* 활성 표시는 중립 다크(슬레이트). teal(초록) 안 씀. 스와치는 제외 */
.annot-bar button[aria-pressed="true"]:not(.swatch) { background: #0f172a; color: #fff; }
.annot-bar .sep { width: 1px; align-self: stretch; background: var(--border, #e2e8f0); margin: 2px 2px; display: none; }
/* 도구/색상은 켰을 때만 노출 */
.annot-bar .tool-only { display: none; }
body.annot-active .annot-bar .tool-only { display: inline-flex; }
body.annot-active .annot-bar .sep { display: block; }

/* 색상 스와치 — 선택해도 색·크기 안 바뀜. 선택 표시는 흰 체크(✓) 오버레이만 */
.annot-bar .swatch { position: relative; width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid #fff !important; box-shadow: 0 0 0 1px var(--border, #e2e8f0); }
.annot-bar .swatch[data-color="navy"] { background: #0f172a !important; }
.annot-bar .swatch[data-color="red"] { background: #e11d48 !important; }
.annot-bar .swatch[data-color="blue"] { background: #2563eb !important; }
.annot-bar .swatch[aria-pressed="true"]::after {
  content: ""; position: absolute; left: 50%; top: 48%;
  width: 8px; height: 4px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff;
  transform: translate(-50%, -50%) rotate(-45deg);
}
/* 굵기 토글 */
.annot-bar .size-btn[data-size="thin"]::before { content: ""; display: inline-block; width: 14px; height: 3px; background: currentColor; border-radius: 2px; vertical-align: middle; }
.annot-bar .size-btn[data-size="thick"]::before { content: ""; display: inline-block; width: 14px; height: 7px; background: currentColor; border-radius: 4px; vertical-align: middle; }
/* 텍스트 글자 크기 버튼 — 텍스트 도구일 때만 노출 */
.annot-bar .text-only { display: none; }
body.annot-active.annot-text .annot-bar .text-only { display: inline-flex; }
.annot-bar .text-only[data-annot="textsmall"] { font-size: 12px; }
.annot-bar .text-only[data-annot="textbig"] { font-size: 17px; }

/* 호버 툴팁 — 버튼에 마우스 올리면 이름+단축키를 말풍선으로 */
.annot-bar [data-tip] { position: relative; }
.annot-bar [data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 9px); transform: translateX(-50%);
  background: #0f172a; color: #fff; font-size: 12px; line-height: 1; white-space: nowrap;
  padding: 6px 8px; border-radius: 6px; box-shadow: 0 4px 12px rgba(15, 23, 42, .22); pointer-events: none; z-index: 2147483002;
}
.annot-bar [data-tip]:hover::before {
  content: ""; position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: #0f172a; pointer-events: none; z-index: 2147483002;
}

@media (max-width: 520px) {
  .annot-bar { left: 8px; right: 8px; bottom: 8px; justify-content: center; }
}
/* 태블릿/터치(거친 포인터) — 손가락 탭 타깃 확대(핸들·×·툴바 버튼·스와치) */
@media (pointer: coarse) {
  .annot-handle { width: 22px; height: 22px; border-radius: 4px; }
  .annot-handle[data-h="nw"] { left: -11px; top: -11px; }
  .annot-handle[data-h="n"]  { left: calc(50% - 11px); top: -11px; }
  .annot-handle[data-h="ne"] { right: -11px; top: -11px; }
  .annot-handle[data-h="e"]  { right: -11px; top: calc(50% - 11px); }
  .annot-handle[data-h="se"] { right: -11px; bottom: -11px; }
  .annot-handle[data-h="s"]  { left: calc(50% - 11px); bottom: -11px; }
  .annot-handle[data-h="sw"] { left: -11px; bottom: -11px; }
  .annot-handle[data-h="w"]  { left: -11px; top: calc(50% - 11px); }
  .annot-del { width: 30px; height: 30px; top: -16px; right: -16px; font-size: 16px; }
  .annot-bar button { padding: 13px 16px; font-size: 15px; }
  .annot-bar .swatch { width: 32px; height: 32px; }
}
@media print {
  .annot-bar { display: none; }
}
