/* 라이트 / 다크 테마 (html[data-theme]) — 캔버스색은 sidebar.js의 CANVAS와 같게 유지 */
:root {
  --bg: #f1f5f9; --panel: #ffffff; --line: #e2e8f0; --text: #0f172a; --muted: #64748b;
  --accent: #0d9488; --accent-soft: #ccfbf1; --canvas: #f8fafc; --dot: #cbd5e1; --paper: #ffffff;
  --ink: #070503; color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #020617; --panel: #111827; --line: #1f2937; --text: #e5e7eb; --muted: #94a3b8;
  --accent: #2dd4bf; --accent-soft: #134e4a; --canvas: #0f172a; --dot: #1e293b; --paper: #1e293b;
  --ink: #f0e8d5; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px 'Malgun Gothic', system-ui, sans-serif; }
body { display: flex; flex-direction: column; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; cursor: pointer; }
button:hover { background: var(--line); }
.pop { position: absolute; z-index: 40; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.22); padding: 6px; }
.pop[hidden] { display: none !important; } /* #menu {display:flex}보다 우선 (안 닫히던 문제) */

/* 상단 */
#top { display: flex; gap: 2px; align-items: center; padding: 6px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; }
#title { flex: 1; min-width: 0; border: 1px solid transparent; background: none; border-radius: 6px; padding: 4px 6px; font-weight: 700; font-size: 14px; }
#title:hover, #title:focus { border-color: var(--line); outline: none; }
#langBtn { padding: 3px 5px; line-height: 0; }
#langBtn svg, #langPop svg { width: 20px; height: 14px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.18); }
#langPop { right: 70px; top: 38px; display: flex; flex-direction: column; min-width: 140px; }
#langPop button { display: flex; gap: 8px; align-items: center; text-align: left; padding: 6px 10px; }
#langPop button.on { background: var(--accent-soft); }
#domainBtn.on { background: var(--accent-soft); border-color: var(--accent); }

/* 툴바 */
/* 창 크기와 관계없이 2줄 고정: 1줄 = 도구·캡처 | 개체 목록, 2줄 = 실행취소~전체 보기 | 화면 설정 (아주 좁으면 그 줄 안에서만 줄바꿈) */
#tools { display: flex; flex-direction: column; gap: 4px; padding: 4px 6px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; }
.trow { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
#tools button { position: relative; min-width: 28px; height: 28px; padding: 0 4px; }
/* 꺼진 도구: 원 + 대각선 금지 표시 */
#tools button.off::after { content: ''; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; transform: translate(-50%, -50%);
  box-sizing: border-box; border: 2px solid #dc2626; border-radius: 50%; pointer-events: none;
  background: linear-gradient(45deg, transparent calc(50% - 1px), #dc2626 calc(50% - 1px), #dc2626 calc(50% + 1px), transparent calc(50% + 1px)); }
#tools button.on { background: var(--accent-soft); border-color: var(--accent); }
#zoomVal { min-width: 38px; text-align: center; color: var(--muted); font-size: 12px; cursor: text; border-radius: 4px; }
#zoomVal:hover { background: var(--line); }
#zoomVal[hidden], #zoomEdit[hidden] { display: none; }
#zoomEdit { width: 46px; height: 24px; padding: 0 2px; font-size: 12px; text-align: center; border: 1px solid var(--accent); border-radius: 4px; background: var(--panel); }
#ctx .clr { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
#ctx .clr .opt { color: #dc2626; }
#ctx .ord .danger { background: #dc2626; color: #fff; border-color: #dc2626; }

/* 색상: 원형 버튼 + 팝업 */
#colorDot { display: block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); margin: auto; }
#colorDot.auto { background: linear-gradient(135deg, #0f172a 50%, #f8fafc 50%) !important; }
#colorPop { left: 6px; top: 36px; width: 214px; }
#swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; padding: 4px; }
#swatches button { width: 26px; height: 26px; min-width: 0; padding: 0; border-radius: 50%; border: 2px solid var(--line); }
#swatches button.on { outline: 2px solid var(--accent); outline-offset: 1px; }
#colorPop .row { display: flex; gap: 4px; padding: 4px; }
#colorPop .row button, #colorCustom .row button { flex: 1; border: 1px solid var(--line); height: 28px; font-size: 12px; }

/* 직접 선택: 채도·명도 사각형 + 색상 막대 + HEX */
#colorCustom { left: 6px; top: 36px; width: 214px; }
#colorCustom .row { display: flex; gap: 6px; padding: 4px; align-items: center; }
#colorCustom #ccBack { flex: none; padding: 0 8px; }
#ccPrev { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); }
#ccHex { width: 0; flex: 1; height: 26px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); padding: 0 6px; font-family: monospace; }
#ccSV { position: relative; height: 120px; margin: 4px; border-radius: 6px; cursor: crosshair; touch-action: none;
  background-image: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent); }
#ccKnob { position: absolute; width: 12px; height: 12px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #000;
  transform: translate(-50%, -50%); pointer-events: none; }
#ccHue { -webkit-appearance: none; appearance: none; display: block; width: calc(100% - 8px); margin: 8px 4px; height: 10px; border-radius: 5px;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); outline: none; }
#ccHue::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px #000; cursor: pointer; }
#colorCustom #ccOk { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 스포이드 사용 중: 사이드바 커서도 스포이드 */
body.picking, body.picking * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M20.7 3.3a2.4 2.4 0 0 0-3.4 0l-2.6 2.6-1.4-1.4-1.4 1.4 1.4 1.4L4 16.6V20h3.4l9.3-9.3 1.4 1.4 1.4-1.4-1.4-1.4 2.6-2.6a2.4 2.4 0 0 0 0-3.4z' fill='%23fff' stroke='%23000' stroke-width='1.3' stroke-linejoin='round'/%3E%3C/svg%3E") 4 20, crosshair !important; }
#eyedrop.on { background: var(--accent-soft); border-color: var(--accent); }

/* 도구 우클릭 고급 설정 */
#ctx { position: fixed; z-index: 45; width: 230px; padding: 0 0 6px; font-size: 12px; }
#ctx .head { display: flex; align-items: center; padding: 4px 4px 4px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
#ctx .head b { flex: 1; }
#ctx label { display: flex; gap: 6px; align-items: flex-start; padding: 5px 10px; cursor: pointer; border-radius: 6px; }
#ctx label:hover { background: var(--line); }
#ctx label.dis { opacity: .45; pointer-events: none; }
#ctx small { color: var(--muted); font-size: 11px; }
#ctx .hint { color: var(--muted); font-size: 11px; margin: 0 10px 4px; }
#ctx .frow { display: flex; gap: 6px; align-items: center; padding: 4px 10px; }
#ctx .frow > span { min-width: 34px; white-space: nowrap; color: var(--muted); flex: none; }
#ctx input[type=number], #ctx select { height: 26px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); padding: 0 4px; }
#ctx input[type=number] { width: 54px; }
#ctx select { flex: 1; min-width: 0; }
#ctx input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
#ctx .tg { width: 30px; height: 26px; border: 1px solid var(--line); }
#ctx .tg.on, #ctx .tex.on { background: var(--accent-soft); border-color: var(--accent); }
#ctx .sw { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px 10px; }
#ctx .sw button { width: 20px; height: 20px; min-width: 0; padding: 0; border-radius: 50%; border: 2px solid var(--line); }
#ctx .sw button.on { outline: 2px solid var(--accent); outline-offset: 1px; }
#ctx .texs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 2px 8px; }
#ctx .tex { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); padding: 2px 4px; font-size: 11px; }
#ctx .tex svg { flex: none; }

/* 굵기 게이지: 양끝이 둥근 긴 선 + 원형 손잡이 + 숫자 */
#sizeBox { display: flex; align-items: center; gap: 6px; margin-left: 4px; }
#sizeBox[hidden] { display: none; }
#sizeR { -webkit-appearance: none; appearance: none; width: 80px; height: 6px; border-radius: 3px; background: var(--line); outline: none; }
#sizeR::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent);
  border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--accent); cursor: pointer; }
#sizeN { width: 34px; height: 24px; padding: 0; font-size: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); text-align: center; }

/* 캔버스 */
#board { flex: 1; position: relative; overflow: hidden; outline: none; touch-action: none; color: var(--ink);
  background-color: var(--canvas); background-image: radial-gradient(var(--dot) 1px, transparent 1px); }
#board.panning { cursor: grab !important; }
#board.t-area { cursor: crosshair; }
#helpGrp, #objGrp { margin-left: auto; }
body.nogrid #board { background-image: none; } /* 모눈점 끄기 */
#board.t-shape { cursor: crosshair; }
#objBtn span { font-size: 12px; }
#viewBtn { font-size: 12px; white-space: nowrap; border: 1px solid var(--line) !important; }
#viewPop { right: 6px; top: 100%; margin-top: 2px; min-width: 210px; display: flex; flex-direction: column; }
#viewPop label { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
#viewPop label:hover { background: var(--line); }
#viewPop .ico { width: 16px; text-align: center; flex: none; }
#viewPop .ico svg { display: block; margin: auto; }
#viewPop small { color: var(--muted); font-size: 11px; }
.shape .shp, .shape .shp svg { display: block; width: 100%; height: 100%; overflow: visible; }
#ctx .shk { display: flex; gap: 4px; padding: 4px 10px; }
#ctx .shk button { flex: 1; height: 28px; border: 1px solid var(--line); font-size: 15px; }
#ctx .shk button.on { background: var(--accent-soft); border-color: var(--accent); }
#ctx .ord { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 6px 8px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
#ctx .ord button { border: 1px solid var(--line); padding: 4px; font-size: 11px; }
#ctx .frow input[type=number] { width: 48px; } /* 단축키 안내 체크: 툴바 오른쪽 끝 = 캔버스의 안내 바로 위 */

/* 영역 선택: 위→아래(완전 포함) = 파란 실선, 아래→위(걸치기) = 초록 점선 */
#marq { display: none; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; overflow: visible; }
#marq.on { display: block; }
#marq rect, #marq polygon { fill: rgba(59,130,246,.08); stroke: #3b82f6; stroke-width: 1.5; }
#marq.cross rect { fill: rgba(34,197,94,.08); stroke: #16a34a; stroke-dasharray: 6 4; }
#selDoc { position: absolute; z-index: 4; user-select: none; -webkit-user-drag: none; width: 30px; height: 30px; padding: 0; font-size: 16px; background: var(--panel);
  border: 1px solid var(--accent); border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
#selDoc[hidden] { display: none; }
#selDoc b { position: absolute; right: -6px; top: -6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; line-height: 16px; padding: 0 3px; }

/* 개체 목록·선택 목록 공용: 그림 폴더 (눌러야 펼쳐짐) */
li.folder { font-weight: 700; }
li.folder .arrow { width: 12px; display: inline-block; color: var(--muted); }
ul.sub { list-style: none; margin: 0; padding: 0 0 0 14px; }
ul.sub[hidden] { display: none; }
#ctx .sl { list-style: none; margin: 0; padding: 0 4px; max-height: 300px; overflow: auto; }
#ctx .sl li { display: flex; gap: 6px; align-items: center; padding: 3px 6px; border-radius: 6px; cursor: pointer; }
#ctx .sl li:hover { background: var(--line); }
#ctx .sl .kind { font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 8px; background: var(--line); white-space: nowrap; }
#ctx .sl .sum { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 400; }
#ctx .opt { display: block; width: calc(100% - 16px); margin: 3px 8px; text-align: left; border: 1px solid var(--line); padding: 5px 8px; }
#ctx .opt.on { background: var(--accent-soft); border-color: var(--accent); }
#board.t-text { cursor: text; }
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
/* 메모 크기 바깥 = 회색 여백 (축소했을 때 보임) */
#pageBox { box-shadow: 0 0 0 1px var(--line), 0 0 0 400000px var(--margin); }
#pageBox { position: absolute; z-index: -2; pointer-events: none; }
#pageBox[hidden] { display: none; }
#pagePop { width: 250px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
#pagePop b { padding: 2px 4px; }
#pagePop .row { display: flex; gap: 4px; align-items: center; padding: 0 4px; }
#pagePop input[type=number] { width: 0; flex: 1; height: 26px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); padding: 0 4px; }
#pagePop input:disabled { background: var(--line); color: var(--muted); }
#pagePop label { display: flex; gap: 6px; align-items: center; padding: 4px; cursor: pointer; border-radius: 6px; }
#pagePop label:hover { background: var(--line); }
#pagePop .hint { color: var(--muted); font-size: 11px; margin: 0 4px; }
#pagePop .row button { flex: 1; border: 1px solid var(--line); height: 28px; }
#pagePop button:disabled { opacity: .45; cursor: default; }
#pageOk:not(:disabled) { background: var(--accent); color: #fff; border-color: var(--accent) !important; }
:root { --margin: #94a3b8; }
:root[data-theme="dark"] { --margin: #020617; }
#ink { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; z-index: 1; } /* 그림은 이미지 위에 */
#ink path { stroke-linecap: round; stroke-linejoin: round; }
#ink path.sel { filter: drop-shadow(0 0 3px var(--accent)); }
#ink path.flash { animation: flashp 1.2s ease-out 2; }
@keyframes flashp { 0% { filter: drop-shadow(0 0 10px #2dd4bf); } 100% { filter: none; } }

/* 단축키 안내: 오른쪽 위, 워터마크처럼 연하게. 글자색 = 캔버스 보색 */
#keys { position: absolute; top: 8px; right: 10px; margin: 0; padding: 0; list-style: none; text-align: right;
  color: var(--ink); opacity: .32; font-size: 11px; line-height: 1.55; pointer-events: none; user-select: none; z-index: 2; }
#keys[hidden] { display: none; }

/* 개체 */
.it { position: absolute; user-select: none; }
.it.sel { outline: 2px solid var(--accent); outline-offset: 2px; }
.it.flash { animation: flash 1.2s ease-out 2; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(45,212,191,.9); } 100% { box-shadow: 0 0 0 18px rgba(45,212,191,0); } }
/* 크기 조절 손잡이 (선택 1개): 모서리·변 / 선은 양 끝점(원형) */
#hdl { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
#hdl i { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; box-sizing: border-box; background: #fff;
  border: 2px solid var(--accent); border-radius: 2px; pointer-events: auto; }
#hdl .h-nw, #hdl .h-se { cursor: nwse-resize; } #hdl .h-ne, #hdl .h-sw { cursor: nesw-resize; }
#hdl .h-n, #hdl .h-s { cursor: ns-resize; } #hdl .h-e, #hdl .h-w { cursor: ew-resize; }
#hdl .h-p1, #hdl .h-p2 { width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; cursor: crosshair; }
#board.grab { cursor: move !important; }
.it[data-shape=line].sel { outline: none; } /* 선은 양 끝 손잡이로 선택 표시 */ /* 선택한 개체 테두리 = 이동 */
.txt { min-height: 1.4em; padding: 4px 6px; white-space: pre-wrap; word-break: break-word; line-height: 1.4; border-radius: 4px; outline: none; }
.txt[contenteditable="true"] { background: var(--paper); box-shadow: 0 0 0 1px var(--accent); cursor: text; user-select: text; }
.img img { width: 100%; height: 100%; display: block; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.25); user-select: none; -webkit-user-drag: none; }
.lnk { background: var(--paper); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 6px; padding: 6px 8px; overflow: hidden; }
.lnk b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lnk small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cap { position: absolute; left: 0; top: 100%; margin-top: 2px; font-size: 10px; color: var(--ink); opacity: .55;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; pointer-events: none; }
body.nosrc .cap { display: none; }

/* 메모 목록 */
#list { position: absolute; left: 0; right: 0; top: 41px; bottom: 0; z-index: 30; background: var(--panel); display: flex; flex-direction: column; }
#list[hidden] { display: none; }
#list .row { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); }
#search { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; background: var(--bg); }
#newNote { background: var(--accent); color: #fff; border-radius: 6px; padding: 5px 10px; white-space: nowrap; }
#notes { list-style: none; margin: 0; padding: 0 0 120px; overflow: auto; flex: 1; }
#notes li { position: relative; display: flex; align-items: center; gap: 4px; padding: 8px 6px 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
#notes li:hover { background: var(--bg); }
#notes li.cur { background: var(--accent-soft); }
#notes li .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#notes li .dom { font-size: 10px; color: var(--accent); border: 1px solid var(--accent); border-radius: 8px; padding: 0 5px; white-space: nowrap; max-width: 40%; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
#notes li .dom:hover { background: var(--accent-soft); }
/* 제목 옆 사이트 표시 (메모 목록의 도메인 배지와 같은 모양), 누르면 그 사이트로 이동 */
#siteChip { flex: 0 1 auto; min-width: 0; max-width: 42%; font-size: 10.5px; color: var(--accent); border: 1px solid var(--accent); border-radius: 9px;
  padding: 1px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.5; }
#siteChip:hover { background: var(--accent-soft); }
#siteChip[hidden] { display: none; }
#title { min-width: 60px; }
/* 단축키 표시: 도구 아이콘 오른쪽 위에 글자만 */
body.keytag #tools button[data-key]::before { content: attr(data-key); position: absolute; top: 0; right: 1px; font-size: 9px; font-weight: 700; line-height: 1; color: var(--muted); pointer-events: none; }
#notes li .d { color: var(--muted); font-size: 11px; white-space: nowrap; }
#notes li > button { min-width: 26px; padding: 2px 4px; }
.mini { position: absolute; right: 6px; top: 100%; margin-top: -4px; z-index: 5; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.22); padding: 6px; display: flex; gap: 4px; align-items: center; font-size: 12px; cursor: default; }
.mini button { border: 1px solid var(--line); padding: 3px 8px; }
.mini.ask { right: auto; margin-top: 0; z-index: 20; }
.it.warn { outline: 2px dashed #dc2626; outline-offset: 2px; }
.mini .danger { background: #dc2626; color: #fff; border-color: #dc2626; }

/* 개체 목록 (아래쪽 패널, 위쪽에는 캔버스가 보임) */
#objs { position: absolute; left: 0; right: 0; bottom: 0; height: 48%; z-index: 25; background: var(--panel);
  border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(0,0,0,.18); display: flex; flex-direction: column; }
#objs[hidden] { display: none; }
#objs .head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); }
#objs .head b { font-size: 13px; }
#objCount { color: var(--muted); font-size: 12px; flex: 1; }
#objList { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
#objList li { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); cursor: pointer; }
#objList li.folder { gap: 4px; }
#objList ul.sub li { padding-left: 4px; }
#objList li:hover { background: var(--bg); }
#objList li.cur { background: var(--accent-soft); }
#objList .kind { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 8px; background: var(--line); white-space: nowrap; }
#objList .thumb { width: 40px; height: 30px; object-fit: cover; border-radius: 3px; flex: none; background: var(--line); }
#objList .body { flex: 1; min-width: 0; }
#objList .sum { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#objList .url { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
#objList .url input { width: 100%; font-size: 11px; border: 1px solid var(--accent); border-radius: 4px; padding: 1px 4px; background: var(--bg); }
#objList li > button { min-width: 24px; padding: 1px 3px; font-size: 12px; }
#objList li > button.mid { color: var(--accent); line-height: 0; }

/* 쿠팡 파트너스 광고 띠: 캔버스 아래 고정 (패널·안내는 그 위까지만) */
#ad { flex: none; height: 136px; background: var(--panel); border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 3px 0 4px; overflow: hidden; }
#ad[hidden] { display: none; }
#ad p { margin: 0 10px 3px; font-size: 10px; line-height: 13px; color: var(--muted); text-align: center; } /* 대가성 문구: 잘리지 않게 두 줄까지 */
#adSlot { width: 320px; height: 100px; flex: none; }
#adSlot iframe { display: block; border: 0; }
body.ad #list, body.ad #objs { bottom: 136px; }
body.ad #toast { bottom: 150px; }

/* 아이콘: 같은 굵기의 선, 글자색을 따라감 */
.ic { display: block; width: 18px; height: 18px; margin: auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#top .ic { width: 19px; height: 19px; }
#objBtn, #viewBtn { display: inline-flex; align-items: center; gap: 4px; }
#objBtn .ic, #viewBtn .ic { margin: 0; }
#ctx .shk .ic { width: 16px; height: 16px; }
#tools button.on .ic { stroke: var(--accent); }
/* 즉시 도움말 */
#tip { position: fixed; z-index: 90; max-width: 240px; padding: 4px 8px; border-radius: 6px; background: #0f172a; color: #fff; font-size: 11.5px; line-height: 1.4; pointer-events: none; box-shadow: 0 3px 10px rgba(0,0,0,.25); }
#tip[hidden] { display: none; }

/* 백업 안내: 오른쪽 아래, 경고가 아닌 공지 톤 */
#bkNote { position: absolute; right: 10px; bottom: 10px; z-index: 6; max-width: 250px; background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; box-shadow: 0 3px 12px rgba(0,0,0,.14); padding: 8px 10px; font-size: 11.5px; }
#bkNote[hidden] { display: none; }
#bkNote p { margin: 0 0 6px; color: var(--muted); line-height: 1.45; }
#bkNote p b { color: var(--text); font-size: 12px; }
#bkNote .row { display: flex; gap: 4px; align-items: center; }
#bkNote .row button { border: 1px solid var(--line); padding: 2px 8px; font-size: 11.5px; }
#bkGo { background: var(--accent) !important; color: #fff; border-color: var(--accent) !important; }
#bkClose { margin-left: auto; border: 0 !important; color: var(--muted); }

/* 새 창에서 실행 중: 사이드바 편집 화면을 덮음 (광고 띠는 그대로) */
#remote { position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: 70; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 16px; }
body.ad #remote { bottom: 136px; }
#remote[hidden] { display: none; }
#remote .box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 16px; text-align: center; max-width: 320px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
#remote b { font-size: 15px; }
#remote p { margin: 8px 0; color: var(--muted); font-size: 12px; }
#remote #remoteInfo { color: var(--accent); font-weight: 700; }
#remote .row { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
#remote .row button { border: 1px solid var(--line); padding: 6px 12px; }
#remoteGo { background: var(--accent) !important; color: #fff; border-color: var(--accent) !important; }

/* 새 창: 맨 위 연결된 페이지 띠 */
#linkBar { display: flex; gap: 8px; align-items: center; padding: 4px 10px; background: var(--accent-soft); color: var(--text); font-size: 12px; border-bottom: 1px solid var(--line); }
#linkBar[hidden] { display: none; }
#linkBar span { color: var(--muted); }
#linkBar b { color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#linkBar small { margin-left: auto; color: var(--muted); white-space: nowrap; }
body.win #list { top: 67px; }

/* 버그 신고 */
#bugPop { position: fixed; right: 8px; top: 40px; width: 250px; z-index: 46; display: flex; flex-direction: column; gap: 6px; padding: 0 0 8px; font-size: 12px; }
#bugPop .head { display: flex; align-items: center; padding: 4px 4px 4px 10px; border-bottom: 1px solid var(--line); }
#bugPop .head b { flex: 1; }
#bugPop .hint { margin: 2px 10px; color: var(--muted); font-size: 11px; line-height: 1.5; }
#bugPop > button { margin: 0 8px; border: 1px solid var(--line); padding: 6px 8px; }
#bugPop textarea, #bugPop input { margin: 6px 8px 0; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); padding: 6px 8px; font: inherit; resize: vertical; }
#bugSend { background: var(--accent) !important; color: #fff; border-color: var(--accent) !important; font-weight: 700; }
#bugSend:disabled { opacity: .6; }
#toast { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50; background: rgba(15,23,42,.92); color: #fff;
  padding: 7px 12px; border-radius: 8px; max-width: 90%; font-size: 12px; }
#toast[hidden] { display: none; }
#toast { pointer-events: none; } /* 안내 문구가 아래 버튼(백업 안내 등)을 가려도 클릭은 통과 */

/* 줄글형 메모: 툴바는 글 서식 줄만, 캔버스 대신 글 칸 (사이드바 폭 = 메모 폭) */
body.docmode #tools .trow:not(#docBar), body.docmode #board { display: none !important; }
#docBar { gap: 6px; flex-wrap: wrap; }
#docBar[hidden] { display: none; }
#docBar select, #docBar input { height: 28px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: inherit; font: inherit; font-size: 12px; padding: 0 6px; }
#dSize { width: 56px; }
#docBar button { min-width: 28px; }
#dColors { display: inline-flex; gap: 3px; flex-wrap: wrap; }
#dColors button { width: 16px; height: 16px; min-width: 0 !important; padding: 0; border-radius: 50%; border: 1px solid var(--line); }
#doc { flex: 1; overflow-y: auto; padding: 14px 16px 40px; outline: none; background: var(--canvas); color: var(--ink); line-height: 1.7;
  white-space: pre-wrap; word-break: break-word; cursor: text; }
#doc[hidden] { display: none; }
#doc:empty::before { content: attr(data-ph); color: var(--muted); }
/* 이미지 넣기 창 */
#imgPop { position: fixed; z-index: 46; width: min(300px, calc(100vw - 12px)); display: flex; flex-direction: column; gap: 6px; padding: 0 0 10px; font-size: 12px; }
#imgPop .head { display: flex; align-items: center; padding: 4px 4px 4px 10px; border-bottom: 1px solid var(--line); }
#imgPop .head b { flex: 1; }
#imgPop .row { display: flex; align-items: center; gap: 6px; margin: 4px 10px 0; }
#imgPop .row span { line-height: 1.4; }
#imgPop small { color: var(--muted); }
#imgPath { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: inherit; padding: 5px 8px; font: inherit; }
#imgBrowse { border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; white-space: nowrap; }
#imgPop .hint { margin: 0 10px; color: var(--muted); font-size: 11px; line-height: 1.5; }
#imgPop .warn { background: var(--bg); border-radius: 6px; padding: 6px 8px; }
#imgGo { margin: 4px 10px 0; border: 0; border-radius: 8px; padding: 7px; background: var(--accent); color: #fff; font-weight: 700; }
#imgGo:disabled { opacity: .5; }
/* 화면 아래 용량 경고 */
#quotaBar { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 12px; background: #fef3c7; color: #92400e; border-top: 1px solid #fcd34d; }
#quotaBar.fail { background: #fee2e2; color: #991b1b; border-top-color: #fca5a5; }
#quotaBar[hidden] { display: none; }
#quotaBar span { flex: 1; line-height: 1.4; }
#quotaBar button { flex: none; border: 1px solid currentColor; border-radius: 6px; padding: 3px 8px; color: inherit; background: none; }
/* 메모 목록: 줄글형 표시, 새 메모 종류 고르기 */
#notes .kd { flex: none; font-size: 10px; padding: 0 5px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
#list .row { position: relative; }
.mini.kinds { display: flex; gap: 6px; padding: 6px; z-index: 31; }
.mini.kinds button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font-weight: 700; }
.mini.kinds small { font-weight: 400; color: var(--muted); font-size: 10.5px; }
#localOpts { gap: 5px; }
#localOpts small { flex-basis: 100%; color: var(--muted); font-size: 10.5px; }

/* 주고받기 */
#drawer .cnt { position: absolute; top: -2px; right: calc(50% - 30px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #ef4444; color: #fff;
  font: 700 10.5px/17px sans-serif; font-style: normal; text-align: center; border: 2px solid var(--panel); }
#drawerTab.has::after { content: ''; position: absolute; top: 4px; left: 3px; width: 7px; height: 7px; border-radius: 50%; background: #ef4444; }
#drawer .chips { display: flex; flex-wrap: wrap; gap: 4px; }
#drawer .chips:empty { display: none; }
#drawer .chips button { border: 1px solid var(--line); border-radius: 12px; padding: 2px 8px; font-size: 11px; background: var(--bg); }
#drawer select { flex: 1; min-width: 0; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: inherit; font: inherit; padding: 0 6px; }
#sendGo { border: 0; border-radius: 10px; padding: 8px; background: var(--accent); color: #fff !important; font-weight: 700; }
#sendGo:disabled { opacity: .5; }
#sendLeft { margin-left: auto; color: var(--muted); font-size: 11px; }
#inTabs em { font-style: normal; margin-left: 3px; color: #ef4444; font-weight: 700; }
#inList { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
#inList li { padding: 7px 9px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
#inList li:last-child { border-bottom: 0; }
#inList .top { display: flex; align-items: baseline; gap: 6px; }
#inList .t { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#inList small { color: var(--muted); font-size: 10.5px; white-space: nowrap; }
#inList .who { color: var(--muted); font-size: 11px; }
#inList .who.stranger { color: #b45309; }
#inList .acts { display: flex; gap: 4px; flex-wrap: wrap; }
#inList .acts button { border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-size: 11px; background: none; }
#inList .acts .main { background: var(--accent); color: #fff !important; border-color: var(--accent); }
#inList .acts .bad { color: #dc2626 !important; }
#inList .st { font-size: 10.5px; padding: 0 6px; border-radius: 8px; background: var(--bg); color: var(--muted); }
#inList .empty { color: var(--muted); }
/* 링크 점검 */
#prevLinks { font-weight: 700; }
#prevLinks.bad { background: #fee2e2 !important; color: #991b1b !important; border-color: #fca5a5 !important; }
#prevLinks[hidden] { display: none; }
#linkPop { position: fixed; left: 50%; top: 18%; transform: translateX(-50%); z-index: 66; width: min(340px, calc(100vw - 20px)); max-height: 70vh; display: flex; flex-direction: column; font-size: 12px; }
#linkPop .head { display: flex; align-items: center; padding: 6px 6px 6px 12px; border-bottom: 1px solid var(--line); }
#linkPop .head b { flex: 1; font-size: 13px; }
#linkBody { padding: 10px 12px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
#linkBody .url { word-break: break-all; font-family: Consolas, monospace; font-size: 12px; background: var(--bg); border-radius: 6px; padding: 8px; line-height: 1.5; }
#linkBody .url b { color: var(--text); background: #fef9c3; border-radius: 3px; padding: 0 2px; }
:root[data-theme="dark"] #linkBody .url b { background: #713f12; }
#linkBody .why { color: #991b1b; line-height: 1.5; }
:root[data-theme="dark"] #linkBody .why { color: #fca5a5; }
#linkBody .hint { color: var(--muted); line-height: 1.5; margin: 0; }
#linkBody .row { display: flex; gap: 6px; flex-wrap: wrap; }
#linkBody .row button { border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; background: none; }
#linkBody .row .main { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
#linkBody ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#linkBody li { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; display: flex; flex-direction: column; gap: 3px; }
#linkBody li.danger { border-color: #fca5a5; background: #fef2f2; }
:root[data-theme="dark"] #linkBody li.danger { background: #450a0a; }
#linkBody li .h { font-weight: 700; word-break: break-all; }
#linkBody li small { color: var(--muted); }
#linkBody li button { align-self: flex-start; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-size: 11px; background: none; }
#drawer .okBox { flex-direction: column; align-items: stretch; cursor: default; }
#okList button { display: inline-flex; gap: 4px; }
#okList .team { border: 1px dashed var(--line); border-radius: 12px; padding: 2px 8px; font-size: 11px; color: var(--muted); }
/* 주소록 */
#ctOpen, #ctGo, #sendGroupX { border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; background: none; white-space: nowrap; }
#sendGroup { background: var(--accent-soft); border-radius: 8px; padding: 5px 8px; }
#sendGroup b { flex: 1; }
#ctTabs em { font-style: normal; margin-left: 3px; color: #ef4444; font-weight: 700; }
#ctList { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
#ctList > li { padding: 7px 9px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
#ctList > li:last-child { border-bottom: 0; }
#ctList .top { display: flex; align-items: baseline; gap: 6px; }
#ctList .n { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ctList small { color: var(--muted); font-size: 10.5px; }
#ctList .tag { font-size: 10px; padding: 0 6px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
#ctList .acts { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
#ctList button { border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-size: 11px; background: none; }
#ctList .main { background: var(--accent); color: #fff !important; border-color: var(--accent); }
#ctList .bad { color: #dc2626 !important; }
#ctList .sub { font-size: 11px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
#ctList .sub b { color: var(--text); font-weight: 600; }
#ctList .sub select, #ctList .sub input { height: 24px; font-size: 11px; flex: 1; min-width: 90px; }
#ctList .empty { color: var(--muted); }
/* 미리보기: 위 띠 + 툴바 숨김 + 캔버스는 보기만 */
#prevBar { flex: none; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 7px 10px; font-size: 12px; background: #eff6ff; color: #1e3a8a; border-bottom: 1px solid #bfdbfe; }
:root[data-theme="dark"] #prevBar { background: #172554; color: #dbeafe; border-color: #1e3a8a; }
#prevBar[hidden] { display: none; }
#prevBar span { flex: 1 1 100%; line-height: 1.4; }
#prevBar button { border: 1px solid currentColor; border-radius: 6px; padding: 3px 9px; color: inherit; background: none; }
#prevAdd { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; font-weight: 700; }
#prevReport { margin-left: auto; color: #dc2626 !important; border-color: #fca5a5 !important; }
body.preview #tools, body.preview #drawerTab, body.preview #bkNote { display: none !important; }

/* 엣지 패널: 오른쪽 손잡이 + 떠 있는 카드 (위 계정 / 가운데 아이콘 6개 / 아래 용량 게이지) */
#drawerTab { position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 28; width: 16px; height: 52px; padding: 0;
  display: flex; align-items: center; justify-content: center; background: var(--accent); color: #fff;
  border: 0; border-radius: 10px 0 0 10px; opacity: .55; box-shadow: -2px 0 8px rgba(0,0,0,.15); }
#drawerTab:hover, #drawerTab:has(+ #drawer:not([hidden])) { opacity: 1; }
#drawerTab .ic { width: 12px; height: 12px; }
#drawerTab { cursor: grab; touch-action: none; } /* 위아래로 끌어 옮김 */
#drawerTab.drag { cursor: grabbing; opacity: 1; }
#drawer { position: fixed; right: 22px; top: 50%; z-index: 60; width: min(272px, calc(100vw - 34px)); max-height: calc(100vh - 24px); transition: width .2s ease;
  display: flex; flex-direction: column; overflow: hidden; background: var(--panel); color: var(--text); font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 32px rgba(0,0,0,.22); }
#drawer[hidden], #drawer [hidden] { display: none !important; } /* display:flex가 숨김을 덮어쓰지 않게 (패널 자신과 안쪽 모두) */
#drawer button { font: inherit; color: inherit; }
/* 위: 계정 */
#who { display: flex; align-items: center; gap: 9px; padding: 12px 12px 10px 14px; border-bottom: 1px solid var(--line); }
#who .av { flex: none; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
#who .av .ic { width: 18px; height: 18px; }
#who .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
#whoName { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
#codeCopy { border: 0; padding: 0; background: none; color: var(--muted); font-size: 11.5px; letter-spacing: .3px; cursor: copy; }
#codeCopy:hover { color: var(--accent); }
#who .ib { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: none; color: var(--muted); }
#who .ib:hover { background: var(--bg); color: var(--text); }
#loginBtn.naver { flex: none; display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 0; border-radius: 15px;
  background: #03c75a; color: #fff; font-weight: 700; }
#loginBtn.naver b { font: 900 14px/1 Arial, sans-serif; }
#loginBtn.naver:disabled { opacity: .6; }
/* 가운데: 아이콘 6개 (3 × 2) */
.dv { padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
#drawer .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 6px; }
#drawer .grid button { position: relative; border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11.5px; }
#drawer .grid i { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--text); transition: transform .12s, border-color .12s; }
#drawer .grid i .ic { width: 22px; height: 22px; }
#drawer .grid button:hover i { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
#drawer .grid button.off i { opacity: .45; }
#evDot { position: absolute; top: 2px; right: calc(50% - 24px); width: 9px; height: 9px; border-radius: 50%; background: #ef4444; border: 2px solid var(--panel); }
/* 안쪽 화면 (계정 설정·설정·이벤트·클라우드) */
.vh { display: flex; align-items: center; gap: 6px; margin: -4px 0 2px -6px; }
.vh b { font-size: 13.5px; }
.vh .back { border: 0; background: none; width: 26px; height: 26px; border-radius: 50%; font-size: 20px; line-height: 1; color: var(--muted); }
.vh .back:hover { background: var(--bg); color: var(--text); }
#drawer p { margin: 0; line-height: 1.55; }
#drawer .hint { color: var(--muted); font-size: 11.5px; }
#drawer .row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#drawer .row > span { color: var(--muted); min-width: 48px; }
#drawer .row button, #testerGo { border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; background: none; }
#drawer input:not([type]) { flex: 1; min-width: 80px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 6px 8px; font: inherit; color: inherit; }
#drawer input[type=checkbox] { flex: none; margin: 0; }
#drawer .opt { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
#drawer .danger { background: #dc2626 !important; color: #fff; border-color: #dc2626 !important; }
#byeAsk { background: var(--bg); border-radius: 8px; padding: 8px; }
#byeAsk span { min-width: 0 !important; flex-basis: 100%; color: var(--text) !important; }
#drawer .ev { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--accent-soft); }
#drawer .ev > b { font-size: 13px; }
#testerBox { display: flex; flex-direction: column; gap: 6px; }
#testerBox .opt { background: var(--panel); }
#testerGo { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; font-weight: 700; padding: 7px; }
#cloudState { margin-left: auto; color: var(--muted); font-size: 11px; }
#cloudList { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
#cloudList li { display: flex; align-items: center; gap: 6px; padding: 6px 9px; border-bottom: 1px solid var(--line); }
#cloudList li:last-child { border-bottom: 0; }
#cloudList label { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; cursor: pointer; }
#cloudList .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cloudList small { color: var(--muted); white-space: nowrap; }
#cloudList button { border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; font-size: 11.5px; background: none; }
/* 아래: 용량 게이지 (누르면 클라우드 보관 화면) */
#gauge { display: flex; align-items: center; gap: 8px; padding: 10px 14px 12px; border-top: 1px solid var(--line); cursor: pointer; }
#gauge:hover { background: var(--bg); }
#gauge > span { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
#cloudBar { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
#cloudBar i { display: block; height: 100%; width: 0; background: var(--accent); }
#cloudBar.full i { background: #dc2626; }
#cloudUse { color: var(--muted); font-size: 11px; white-space: nowrap; }
#ctx .edgeOpt { display: flex; align-items: center; gap: 7px; padding: 8px 10px 4px; cursor: pointer; }
#ctx [data-k=open] { display: block; margin: 6px 10px 4px; width: calc(100% - 20px); border: 1px solid var(--line); border-radius: 6px; padding: 5px; }
/* 백업 저장·불러오기: 카드가 왼쪽으로 넓어지고 안쪽 화면이 미끄러져 들어옴 */
#drawer.wide { width: min(330px, calc(100vw - 34px)); }
.dv:not([hidden]) { animation: dvIn .2s ease-out; }
@keyframes dvIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
#drawer .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#drawer .two button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 6px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--bg); }
#drawer .two button:hover, #drawer .two button.on { border-color: var(--accent); color: var(--accent); }
#drawer .two i { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--panel); }
#drawer .two i .ic { width: 22px; height: 22px; }
#drawer .two span { font-weight: 700; }
#drawer .two small { color: var(--muted); font-size: 10.5px; text-align: center; line-height: 1.35; }
#drawer .opt small { color: var(--muted); font-size: 10.5px; }
#drawer .always { margin-top: 2px; background: var(--accent-soft); border-color: transparent; }
#drawer .legal { margin: 2px 0 0; font-size: 10.5px; line-height: 1.5; color: var(--muted); }
#drawer .legal a { color: var(--accent); text-decoration: underline; cursor: pointer; }
#keepRow { display: flex; align-items: center; gap: 7px; margin-top: 6px; color: var(--muted); font-size: 11.5px; cursor: pointer; }
#drawer .tabs { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--bg); }
#drawer .tabs button { flex: 1; border: 0; border-radius: 8px; padding: 5px; background: none; color: var(--muted); }
#drawer .tabs button.on { background: var(--panel); color: var(--text); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
#pickList { list-style: none; margin: 0; padding: 0; max-height: 230px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
#pickList li { border-bottom: 1px solid var(--line); }
#pickList li:last-child { border-bottom: 0; }
#pickList label { display: flex; align-items: center; gap: 7px; padding: 6px 9px; cursor: pointer; }
#pickList .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pickList small { color: var(--muted); white-space: nowrap; font-size: 10.5px; }
#pickGo { border: 0; border-radius: 10px; padding: 8px; background: var(--accent); color: #fff !important; font-weight: 700; }
#pickGo:disabled { opacity: .5; }
#lockHint { padding: 10px 14px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; }
#lockHint:empty { display: none; }

/* 좁은 사이드바: 글자 라벨을 숨기고 아이콘만 (줄이 넘어가지 않게) */
@media (max-width: 520px) {
  #objBtn span, #viewBtn span { display: none; }
  .trow { gap: 4px 4px; }
  #sizeR { width: 56px; }
}
@media (max-width: 380px) { /* 아주 좁을 때: 굵기는 슬라이더만, 버튼 조금 좁게 (2줄에 출처·도움말까지 한 줄로) */
  #sizeN { display: none; }
  #tools .trow button { min-width: 23px !important; }
}
@media (max-width: 400px) {
  #tools { padding: 4px 3px; }
  .trow { gap: 4px 2px; }
  #tools button { min-width: 25px; padding: 0 2px; }
  #sizeR { width: 40px; }
  #zoomVal { min-width: 34px; }
}
.grp { display: flex; align-items: center; gap: 1px; }
