/* ─────────────────────────────────────────────
   보드(무한 캔버스) — 오브젝트 모양과 확대 효과
   보드 화면, AI 화면의 미리보기, 내보낸 HTML 이 같은 파일을 쓴다.
   ───────────────────────────────────────────── */
.bd-viewport {
  position: absolute; inset: 0; overflow: hidden; cursor: grab;
  touch-action: none; user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
  background-color: #17181d;
  background-image: radial-gradient(rgba(255, 255, 255, .13) 1.1px, transparent 1.6px);
  background-size: 28px 28px;
}
.bd-viewport.dragging { cursor: grabbing; }
.bd-viewport.locked { cursor: default; }

.bd-dimmer {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: rgba(9, 9, 13, .6); transition: opacity .42s ease;
}
.bd-viewport.zooming .bd-dimmer { opacity: 1; }

.bd-world {
  position: absolute; left: 0; top: 0; width: 3600px; height: 2600px;
  transform-origin: 0 0;
}

/* ── 오브젝트 공통 ── */
.obj {
  position: absolute; rotate: var(--r, 0deg); scale: 1;
  transition: scale .38s cubic-bezier(.22, 1.4, .36, 1), filter .42s ease, opacity .3s ease;
}
.obj.grab { cursor: pointer; }
.obj.grab:hover { scale: 1.03; }
.obj.dragging-obj {
  z-index: 99990 !important; scale: 1.05; transition: none;
  filter: drop-shadow(0 26px 44px rgba(0, 0, 0, .55));
}
/* 나타날 때는 transform 으로 움직인다 — 확대에 쓰는 scale/translate/rotate 값과 섞이지 않게 */
.obj.enter { animation: obj-enter .5s cubic-bezier(.22, 1.4, .36, 1) both; }
@keyframes obj-enter { from { opacity: 0; transform: scale(.6) } to { opacity: 1; transform: none } }
.obj.leave { opacity: 0; transform: scale(.7); pointer-events: none;
  transition: opacity .3s ease, transform .3s ease; }

/* 확대: 가운데로 오고, 나머지는 살짝 흐려진다 */
.obj.zoom-anim {
  transition: translate .52s cubic-bezier(.2, .9, .25, 1), scale .52s cubic-bezier(.2, .9, .25, 1),
              rotate .52s cubic-bezier(.2, .9, .25, 1), filter .42s ease;
}
.obj.zoomed {
  z-index: 99999 !important; cursor: default;
  filter: drop-shadow(0 22px 46px rgba(0, 0, 0, .6));
}
/* 다 커진 뒤에 자리가 바뀌면(아래 막대의 높이가 달라질 때) 부드럽게 따라간다 */
.obj.zoomed:not(.zoom-anim) { transition: translate .3s ease, scale .3s ease, filter .42s ease; }
.obj.zoomed:hover { scale: unset; }
.bd-world.zooming .obj:not(.zoomed) {
  filter: blur(5px) brightness(.62) saturate(.85); pointer-events: none;
}

/* ── 테이프 (사진·만화 위에 붙는다) ── */
.obj .tape {
  position: absolute; top: -13px; left: 50%; width: 104px; height: 28px; margin-left: -52px;
  rotate: var(--tape-r, -6deg); pointer-events: none;
  background: rgba(226, 220, 196, .46);
  border-left: 1px dashed rgba(0, 0, 0, .14); border-right: 1px dashed rgba(0, 0, 0, .14);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .18);
}
.obj .tape.mint { background: rgba(150, 222, 200, .46); }
.obj .tape.pink { background: rgba(255, 177, 201, .46); }

/* ── 사진 (폴라로이드) ── */
.polaroid {
  padding: 12px 12px 0; background: #f5f2ea; border-radius: 3px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
}
.polaroid .ph {
  position: relative; width: 100%; border-radius: 2px; overflow: hidden; background: #ded9cb;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
.polaroid .ph img, .polaroid .ph video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
  -webkit-user-drag: none; user-select: none; pointer-events: none;
}
.polaroid .cap {
  font-family: "Nanum Pen Script", "Jua", cursive; font-size: 23px; line-height: 1.15; color: #3c3833;
  text-align: center; padding: 10px 4px 13px; letter-spacing: .5px; word-break: keep-all;
}
.polaroid.comic { padding: 14px 14px 0; }
.polaroid.comic .kind {
  position: absolute; left: 22px; top: 22px; z-index: 1; padding: 2px 9px; border-radius: 99px;
  font-family: "JetBrains Mono", monospace; font-size: 9.5px; letter-spacing: 1.5px;
  color: #232019; background: #ffd77a; box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

/* ── 영상 ── */
.clip {
  padding: 10px 10px 0; border-radius: 16px;
  background: rgba(30, 31, 38, .96); border: 1px solid rgba(255, 255, 255, .13);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .5);
}
.clip .ph { position: relative; width: 100%; border-radius: 9px; overflow: hidden; background: #0e0e12; }
.clip .ph img, .clip .ph video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
  -webkit-user-drag: none; user-select: none;
}
.clip .ph img { pointer-events: none; }
.clip .ph video { pointer-events: none; }
.clip.zoomed .ph video { pointer-events: auto; }
.clip .play {
  position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px;
  border-radius: 50%; display: grid; place-items: center; pointer-events: none;
  background: rgba(232, 232, 236, .94); color: #17181d; font-size: 18px; padding-left: 4px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .45); transition: opacity .25s, scale .25s;
}
.clip.zoomed .play { opacity: 0; scale: .6; }
.clip .row { display: flex; align-items: center; gap: 9px; padding: 10px 6px 11px; }
.clip .dot {
  width: 9px; height: 9px; flex: none; border-radius: 50%;
  background: linear-gradient(135deg, #7c8cf8, #d78cf8);
}
.clip .cap {
  flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; color: #e8e8ec;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.clip .len { font-family: "JetBrains Mono", monospace; font-size: 10px; letter-spacing: 1px; color: #85879a; }

/* ── 메모 (스티키 노트) ── */
.sticky {
  width: 196px; min-height: 182px; padding: 22px 18px 18px;
  font-family: "Nanum Pen Script", "Jua", cursive; font-size: 25px; line-height: 1.3; color: #4a4233;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .4);
  background: linear-gradient(180deg, #ffe98a, #f8d95f);
}
.sticky.pink { background: linear-gradient(180deg, #ffc7d8, #f9a8c2); color: #5c3040; }
.sticky.mint { background: linear-gradient(180deg, #b9f3d4, #8fe3b8); color: #24523c; }
.sticky.sky { background: linear-gradient(180deg, #c4e3ff, #9fd0ff); color: #24405c; }
.sticky.lilac { background: linear-gradient(180deg, #e3cdfb, #cda9f5); color: #45305c; }
.sticky::before {
  content: ""; position: absolute; top: -11px; left: 50%; transform: translateX(-50%) rotate(-2deg);
  width: 84px; height: 24px; background: rgba(240, 236, 220, .55);
  border-left: 1px dashed rgba(0, 0, 0, .08); border-right: 1px dashed rgba(0, 0, 0, .08);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .12);
}
.sticky .txt {
  outline: none; min-height: 96px; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere;
}
.sticky .txt:empty::before { content: attr(data-ph); opacity: .45; }
.sticky.zoomed .txt[contenteditable="true"] { cursor: text; user-select: text; -webkit-user-select: text; }
.sticky small { display: block; margin-top: 10px; font-size: 18px; line-height: 1.2; opacity: .62; }

/* 메모의 쓰임: 내 질문 · 내 설명 · 정리 답 */
.sticky .kindtag {
  display: inline-block; margin: -6px 0 9px -4px; padding: 3px 11px 3px 9px; border-radius: 99px;
  font-family: "Jua", "Noto Sans KR", sans-serif; font-size: 14px; line-height: 1.3; letter-spacing: .01em;
  color: rgba(35, 32, 25, .8); background: rgba(255, 255, 255, .55); box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
.sticky.long { width: 262px; min-height: 210px; font-size: 23px; }
.sticky .cover {
  position: absolute; inset: 0; display: none; place-items: center; align-content: center; gap: 4px; text-align: center;
  background: repeating-linear-gradient(135deg, rgba(35, 32, 25, .9) 0 14px, rgba(52, 48, 40, .9) 14px 28px);
  color: #f5f2ea; font-family: "Jua", "Noto Sans KR", sans-serif; font-size: 17px;
}
.sticky .cover b { font-size: 34px; font-weight: 400; line-height: 1; }
.sticky.covered .cover { display: grid; }
.sticky.covered .txt, .sticky.covered small { visibility: hidden; }

/* ── 글 카드 (선생님의 설명) ── */
.note {
  width: 330px; padding: 24px 26px 18px; background: #f5f2ea; color: #232019; border-radius: 5px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .25);
}
.note::before {                       /* 공책 왼쪽의 빨간 세로줄 */
  content: ""; position: absolute; left: 14px; top: 0; bottom: 0; width: 1.5px; background: rgba(201, 85, 62, .28);
}
.note .head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.note .emo {
  flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; line-height: 1; background: rgba(35, 32, 25, .07);
}
.note .ttl {
  flex: 1; min-width: 0; padding-top: 3px;
  font-family: "Noto Sans KR", sans-serif; font-weight: 900; font-size: 19px; line-height: 1.35;
  letter-spacing: -.02em; word-break: keep-all;
}
.note .body {
  font-family: "Noto Sans KR", sans-serif; font-size: 15px; font-weight: 500; color: #3a362d;
  line-height: 28px; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere;
  background-image: repeating-linear-gradient(180deg, transparent 0 27px, rgba(35, 32, 25, .1) 27px 28px);
}
.note .who {
  margin-top: 14px; font-family: "JetBrains Mono", monospace; font-size: 10px; letter-spacing: 1.4px;
  color: #8a8474; display: flex; justify-content: space-between; gap: 8px;
}

/* ── 손글씨 라벨 · 낙서 ── */
.label {
  font-family: "Nanum Pen Script", "Jua", cursive; font-size: 32px; line-height: 1.1; white-space: nowrap;
  color: var(--c, #9fd0ff); text-shadow: 0 4px 18px rgba(0, 0, 0, .5); pointer-events: none;
}
.doodle { pointer-events: none; color: var(--c, #9fd0ff); }
.doodle svg { display: block; overflow: visible; }

/* ── 확대했을 때 뜨는 막대: 위는 정보(내 질문·고친 곳), 아래는 버튼 ── */
.bd-zoombar {
  position: absolute; z-index: 40; left: 50%; bottom: 22px; translate: -50% 0;
  display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 9px;
  border-radius: 24px; background: rgba(28, 29, 36, .84); border: 1px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  opacity: 0; pointer-events: none; transform: translateY(16px);
  transition: opacity .3s ease, transform .4s cubic-bezier(.22, 1.4, .36, 1);
  width: max-content; max-width: min(calc(100% - 24px), 640px);
}
.bd-zoombar.show { opacity: 1; pointer-events: auto; transform: none; }
.bd-zoombar .acts { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.bd-zoombar .info {
  display: grid; gap: 3px; padding: 9px 14px; border-radius: 16px; background: rgba(255, 255, 255, .07);
  font-size: 13.5px; line-height: 1.5; max-height: 118px; overflow-y: auto;
}
.bd-zoombar .info .line { display: grid; grid-template-columns: 92px 1fr; gap: 8px; align-items: baseline; }
.bd-zoombar .info b { font-family: "Jua", "Noto Sans KR", sans-serif; font-weight: 400; font-size: 13.5px; color: #b9bac4; white-space: nowrap; }
.bd-zoombar .info span { color: #ececf1; word-break: keep-all; overflow-wrap: anywhere; }
.bd-zoombar .info .todo span { color: #ffe49a; }
.bd-zoombar .swatches { display: flex; gap: 6px; padding: 0 6px 0 8px; }
.bd-zoombar .sw {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25);
  transition: scale .2s cubic-bezier(.22, 1.4, .36, 1), border-color .2s;
}
.bd-zoombar .sw:hover { scale: 1.15; }
.bd-zoombar .sw.on { border-color: #fff; scale: 1.12; }
.bd-zoombar .sw.yellow { background: #f8d95f; }
.bd-zoombar .sw.pink { background: #f9a8c2; }
.bd-zoombar .sw.mint { background: #8fe3b8; }
.bd-zoombar .sw.sky { background: #9fd0ff; }
.bd-zoombar .sw.lilac { background: #cda9f5; }
.bd-zoombar .tip { padding: 0 10px; font-size: 13px; color: #b9bac4; white-space: nowrap; }
.bd-zoombar .btn.mint { color: #0f3a24; background: #8be9b7; border-color: transparent; }
.bd-zoombar .btn.mint:hover { background: #a6f1c9; }

.bd-close {
  position: absolute; z-index: 41; top: 22px; right: 22px;
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 20px 0 16px;
  border-radius: 99px; font-family: "Jua", "Noto Sans KR", sans-serif; font-size: 17px; color: #17181d;
  background: #f5f2ea; box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
  opacity: 0; pointer-events: none; scale: .8;
  transition: opacity .3s ease, scale .4s cubic-bezier(.22, 1.4, .36, 1);
}
.bd-close.show { opacity: 1; pointer-events: auto; scale: 1; }
.bd-close:hover { background: #fff; }
.bd-close b { font-size: 15px; font-weight: 900; }

/* ── 미니맵 ── */
.bd-minimap {
  position: absolute; z-index: 30; right: 18px; bottom: 18px; padding: 8px;
  background: rgba(28, 29, 36, .62); border: 1px solid rgba(255, 255, 255, .14); border-radius: 14px;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .4); cursor: pointer;
  transition: opacity .3s ease;
}
.bd-minimap canvas { display: block; border-radius: 8px; }
.bd-minimap .lbl {
  font-family: "JetBrains Mono", monospace; font-size: 9px; letter-spacing: 2px;
  color: #6f717e; text-align: center; margin-top: 6px;
}
.bd-viewport.zooming ~ .bd-minimap, .bd-viewport.zooming ~ .bd-hint { opacity: 0; pointer-events: none; }

.bd-hint {
  position: absolute; z-index: 30; left: 20px; bottom: 20px;
  font-family: "JetBrains Mono", "Noto Sans KR", monospace; font-size: 11px; letter-spacing: 1px;
  color: rgba(232, 232, 236, .48); pointer-events: none; transition: opacity .3s ease;
}

@media (max-width: 800px) {
  .bd-minimap { right: 12px; bottom: 12px; transform: scale(.82); transform-origin: bottom right; }
  .bd-hint { display: none; }
  .bd-close { top: 14px; right: 14px; }
}
