/* 메신저 방명록 스킨 - 모든 규칙은 #gb 안에서만 적용됩니다 (사이트 CSS와 충돌 방지) */
#gb{
  --main:#2f6fd6; --bg:#f3f6fb; --me:#dbeafe; --you:#fff3d1; --title-text:#fff;
  --line:color-mix(in srgb,var(--main) 25%,#fff);
  --text:#1f2937; --sub:#6b7280;
  --font:'Malgun Gothic','맑은 고딕',Dotum,'돋움',sans-serif;
  font:13px/1.55 var(--font); color:var(--text); text-align:left;
  display:flex; justify-content:center; padding:12px; background:transparent;
}
#gb *{box-sizing:border-box}
#gb button,#gb input,#gb textarea,#gb select{font-family:var(--font);font-size:13px}
#gb [hidden]{display:none!important}

/* 창 */
#gb .win{width:760px;max-width:100%;height:min(820px,calc(100vh - 24px));min-height:480px;display:flex;flex-direction:column;
  background:var(--bg);border:1px solid var(--main);box-shadow:0 2px 10px rgba(0,0,0,.18);overflow:hidden}
#gb .titlebar{display:flex;align-items:center;gap:2px;padding:5px 6px 5px 10px;background:var(--main);color:var(--title-text);font-weight:600}
#gb .titlebar .t{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#gb .wb{width:24px;height:20px;border:0;background:transparent;color:inherit;font-size:12px;line-height:1;padding:0;cursor:default}
#gb .wb:hover{background:rgba(255,255,255,.22)}

/* 메뉴바 */
#gb .menubar{display:flex;flex-wrap:wrap;padding:2px 6px;background:#fff;border-bottom:1px solid var(--line)}
#gb .menubar button{border:0;background:none;padding:2px 8px;color:var(--text);cursor:pointer}
#gb .menubar button:hover{background:var(--bg)}

/* 상대방 정보 */
#gb .buddy{display:flex;align-items:center;gap:10px;padding:10px 12px;background:#fff;border-bottom:1px solid var(--line)}
#gb .avatar{width:44px;height:44px;flex:none;border-radius:4px;overflow:hidden;display:grid;place-items:center;font-size:24px;background:var(--you)}
#gb .avatar img,#gb .face img{width:100%;height:100%;object-fit:cover;display:block}
#gb .buddy .info{flex:1;min-width:0}
#gb .buddy .nm b{font-size:14px}
#gb .buddy .msg{color:var(--sub);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#gb .adm-badge{margin-left:6px;padding:0 6px;border-radius:8px;background:var(--main);color:var(--title-text);font-size:10px}

/* 대화 */
#gb .chat{flex:1;overflow-y:auto;padding:12px 14px;background:#fff}
#gb .sys{text-align:center;color:var(--sub);font-size:11px;margin:10px 0}
#gb .more{display:block;margin:0 auto 10px;border:1px solid var(--line);background:#fff;border-radius:3px;padding:2px 12px;cursor:pointer;color:var(--sub)}
#gb .empty{text-align:center;color:var(--sub);padding:50px 10px}
#gb .row{display:flex;gap:8px;margin:8px 0;align-items:flex-start}
#gb .row.me{justify-content:flex-end}
#gb .face{width:30px;height:30px;flex:none;border-radius:4px;overflow:hidden;display:grid;place-items:center;background:var(--you);font-size:16px}
#gb .col{max-width:72%;display:flex;flex-direction:column}
#gb .row.me .col{align-items:flex-end}
#gb .meta{font-size:11px;color:var(--sub);margin-bottom:2px}
#gb .meta b{color:var(--text)}
#gb .bub{padding:7px 11px;border-radius:10px;border:1px solid;word-break:break-word;white-space:pre-wrap}
#gb .me .bub{background:var(--me);border-color:color-mix(in srgb,var(--me) 82%,#000);border-top-right-radius:2px}
#gb .you .bub{background:var(--you);border-color:color-mix(in srgb,var(--you) 82%,#000);border-top-left-radius:2px}
#gb .bub.lock{cursor:pointer;color:var(--sub)}
#gb .bub a{color:inherit;text-decoration:underline}
#gb .tag{font-size:11px;color:var(--sub);margin-right:4px}
#gb .emo{vertical-align:middle;margin:0 1px}
#gb .acts{display:flex;gap:8px;font-size:11px;margin-top:2px;opacity:.5}
#gb .row:hover .acts,#gb .acts:focus-within{opacity:1}
#gb .acts button{border:0;background:none;padding:0;color:var(--main);cursor:pointer;font-size:11px}
#gb .acts button:hover{text-decoration:underline}

/* 입력 */
#gb .compose{padding:8px 12px 6px;background:var(--bg);border-top:1px solid var(--line)}
#gb .tools{display:flex;flex-wrap:wrap;gap:2px;margin-bottom:6px}
#gb .tools button{border:1px solid transparent;background:none;border-radius:3px;padding:2px 4px;font-size:16px;line-height:1;cursor:pointer;min-width:28px;height:28px;display:grid;place-items:center}
#gb .tools button:hover{background:#fff;border-color:var(--line)}
#gb .tools img{display:block;width:22px;height:22px}
#gb .who{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin-bottom:6px}
#gb .who label{color:var(--sub)}
#gb .who input[type=text],#gb .who input[type=password]{width:100px}
#gb .secret{margin-left:auto;display:flex;align-items:center;gap:4px;cursor:pointer;color:var(--text)!important}
#gb input[type=text],#gb input[type=password],#gb textarea,#gb select{color:var(--text);border:1px solid var(--line);border-radius:3px;padding:4px 6px;background:#fff}
#gb input:focus,#gb textarea:focus,#gb select:focus,#gb button:focus-visible{outline:2px solid color-mix(in srgb,var(--main) 55%,#fff);outline-offset:1px}
#gb .send{display:flex;gap:6px}
#gb .send textarea{flex:1;height:56px;resize:none}
#gb .btn{border:1px solid var(--line);border-radius:3px;background:#fff;color:var(--text);padding:4px 12px;cursor:pointer}
#gb .btn:hover{background:var(--bg)}
#gb .btn.go{background:var(--main);border-color:var(--main);color:var(--title-text);font-weight:600}
#gb .btn.go:hover{filter:brightness(1.08)}
#gb .btn.sm{padding:2px 8px;font-size:12px}
#gb .cnt{font-size:11px;color:var(--sub);text-align:right;margin-top:2px}
#gb .status{display:flex;justify-content:space-between;align-items:center;padding:3px 10px;background:#fff;border-top:1px solid var(--line);color:var(--sub);font-size:11px;min-height:24px}
#gb .adminbar{display:flex;gap:10px}
#gb .adminbar button{border:0;background:none;padding:0;color:var(--main);font-size:11px;cursor:pointer}
#gb .adminbar button:hover{text-decoration:underline}

/* 대화상자 */
#gb .ovl{position:fixed;inset:0;background:rgba(0,0,0,.3);display:none;align-items:center;justify-content:center;z-index:9999;padding:12px}
#gb .ovl.on{display:flex}
#gb .dlg{width:320px;max-width:100%;max-height:92vh;display:flex;flex-direction:column;background:var(--bg);border:1px solid var(--main);box-shadow:0 4px 16px rgba(0,0,0,.3)}
#gb .dlg.wide{width:460px}
#gb .dlg .body{padding:14px;display:flex;flex-direction:column;gap:8px;overflow-y:auto}
#gb .dlg textarea{height:84px;resize:none}
#gb .dlg .foot{display:flex;justify-content:flex-end;gap:6px;padding:0 14px 14px}
#gb .err{color:#c62d1b;min-height:16px;font-size:12px}
#gb .hint{color:var(--sub);font-size:12px}

/* 테마 편집 */
#gb .presets{display:flex;gap:8px}
#gb .preset{width:28px;height:28px;border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px var(--line);cursor:pointer;padding:0}
#gb .colors{display:grid;grid-template-columns:1fr 1fr;gap:8px 14px}
#gb .colors label,#gb .rng{display:flex;align-items:center;justify-content:space-between;gap:8px}
#gb input[type=color]{width:44px;height:26px;padding:0;border:1px solid var(--line);background:#fff;cursor:pointer}
/* 메뉴 편집 */
#gb .mlist{display:flex;flex-direction:column;gap:8px;max-height:46vh;overflow-y:auto}
#gb .mrow{display:grid;grid-template-columns:110px 1fr 24px;gap:6px;align-items:start}
#gb .mrow textarea{height:52px}
#gb .mrow .md{border:0;background:none;color:var(--sub);cursor:pointer;font-size:14px}
/* 이모티콘 */
#gb .egrid{display:flex;flex-wrap:wrap;gap:8px;min-height:48px}
#gb .eitem{position:relative;width:48px;height:48px;border:1px solid var(--line);background:#fff;display:grid;place-items:center}
#gb .eitem img{max-width:40px;max-height:40px}
#gb .eitem .ed{position:absolute;top:-6px;right:-6px;width:16px;height:16px;border-radius:50%;border:0;background:#c62d1b;color:#fff;font-size:9px;line-height:1;padding:0;cursor:pointer}
#gb .cropbox{align-self:center;border:1px solid var(--line);background:#fff;line-height:0}
#gb .cropbox canvas{width:240px;height:240px;touch-action:none;cursor:grab}

@media (max-width:520px){
  #gb{padding:0}
  #gb .win{height:100vh;border-left:0;border-right:0}
  #gb .col{max-width:85%}
}
