/* Community chat panel — docks into the empty left side on wide screens (content slides right),
   floats over the page on narrower screens, full screen on phones. */
:root{--ch-w:368px;--ch-gap:12px;--ch-spring:linear(0,.06 2%,.23 5%,.48 9%,.71 14%,.87 19%,.96 25%,1.01 32%,1.02 40%,1.01 50%,1 65%,1);--ch-bounce:linear(0,.25 6%,.7 14%,1.08 24%,1.16 31%,1.1 40%,.99 52%,.97 60%,1 75%,1)}
body{transition:padding-left .6s var(--ch-spring)}
body.ch-docked{padding-left:calc(var(--ch-w) + var(--ch-gap) * 2)}
body.ch-instant,body.ch-instant .ch,body.ch-instant .ch-fab{transition:none!important}

/* launcher */
.ch-fab{position:fixed;left:20px;bottom:calc(20px + env(safe-area-inset-bottom));z-index:120;width:58px;height:58px;border-radius:50%;background:#111;color:#fff;display:grid;place-items:center;box-shadow:0 12px 30px rgba(17,17,17,.3);transition:transform .6s var(--ch-spring),opacity .25s}
.ch-fab:hover{transform:scale(1.06)}
.ch-fab:active{transform:scale(.92);transition-duration:.12s}
.ch-fab svg{width:26px;height:26px}
body.ch-open .ch-fab{transform:scale(.4);opacity:0;pointer-events:none}
.chb{position:absolute;top:-3px;right:-3px;min-width:22px;height:22px;padding:0 6px;border-radius:999px;background:#ef4444;color:#fff;font:800 11.5px/22px 'Pretendard',-apple-system,sans-serif;text-align:center;border:2.5px solid var(--bg,#F3F3F1)}
.chb.bump{animation:chBump .6s var(--ch-bounce)}
@keyframes chBump{from{transform:scale(.3)}}

/* panel */
.ch{position:fixed;z-index:130;left:var(--ch-gap);top:var(--ch-gap);bottom:var(--ch-gap);width:var(--ch-w);display:flex;flex-direction:column;background:#fff;border-radius:28px;box-shadow:0 2px 6px rgba(17,17,17,.05),0 30px 70px rgba(17,17,17,.16);overflow:hidden;transform:translateX(calc(-100% - 40px));visibility:hidden;transition:transform .65s var(--ch-spring),visibility 0s .65s}
body.ch-open .ch{transform:none;visibility:visible;transition:transform .65s var(--ch-spring),visibility 0s}
.ch-shade{position:fixed;inset:0;z-index:125;background:rgba(17,17,17,.25);opacity:0;pointer-events:none;transition:opacity .3s}
body.ch-open:not(.ch-docked) .ch-shade{opacity:1;pointer-events:auto}

.ch-h{display:flex;align-items:center;gap:10px;padding:18px 16px 10px 22px}
.ch-t b{display:block;font-size:17px;font-weight:800;letter-spacing:-.5px}
.ch-t small{display:flex;align-items:center;gap:6px;margin-top:3px;font-size:12px;color:#8a8a85;font-weight:600}
.live{width:7px;height:7px;border-radius:50%;background:#22c55e;box-shadow:0 0 0 0 rgba(34,197,94,.5);animation:live 2s infinite}
@keyframes live{70%{box-shadow:0 0 0 6px rgba(34,197,94,0)}100%{box-shadow:0 0 0 0 rgba(34,197,94,0)}}
.ch-x{margin-left:auto;width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:rgba(17,17,17,.05);transition:transform .5s var(--ch-spring),background .2s}
.ch-x:hover{background:rgba(17,17,17,.09)}.ch-x:active{transform:scale(.88)}
.ch-x svg{width:18px;height:18px}

.ch-rooms{position:relative;display:flex;gap:2px;margin:4px 16px 10px;padding:4px;border-radius:999px;background:rgba(17,17,17,.05);isolation:isolate}
.ch-rooms button{position:relative;z-index:1;flex:1;padding:8px 6px;border-radius:999px;font-size:13px;font-weight:700;color:#8a8a85;transition:color .25s;white-space:nowrap}
.ch-rooms button.on{color:#111}
.ch-rooms .ind{position:absolute;z-index:0;top:4px;left:0;height:calc(100% - 8px);border-radius:999px;background:#fff;box-shadow:0 2px 8px rgba(17,17,17,.1);transition:transform .6s var(--ch-spring),width .6s var(--ch-spring)}
.ch-rooms .rd{position:absolute;top:6px;right:10px;width:6px;height:6px;border-radius:50%;background:#ef4444}

.ch-list{flex:1;overflow-y:auto;padding:6px 14px 14px;background:#F6F6F4;margin:0 8px;border-radius:22px;scroll-behavior:auto;overscroll-behavior:contain;outline:0}
.ch-day{display:flex;justify-content:center;margin:14px 0 8px}
.ch-day span{font-size:11.5px;font-weight:700;color:#8a8a85;background:rgba(17,17,17,.05);padding:5px 11px;border-radius:999px}
.ch-empty{display:grid;place-items:center;height:100%;color:#8a8a85;font-weight:600}
.msg{display:flex;gap:8px;margin-top:3px}
.msg.first{margin-top:12px}
.msg .ma{width:34px;flex:0 0 34px}
.msg .ma .av{width:34px;height:34px;font-size:13px}
.msg .mc{min-width:0;max-width:78%;display:flex;flex-direction:column}
.msg .mn{font-size:12px;font-weight:700;color:#4b4b48;margin:0 0 4px 2px}
.msg .mr{display:flex;align-items:flex-end;gap:6px}
.msg time{flex:0 0 auto;font-size:10.5px;color:#a7a7a1;font-weight:600;white-space:nowrap;margin-bottom:2px}
.msg.me{justify-content:flex-end}
.msg.me .mc{align-items:flex-end}
.msg.me .mr{flex-direction:row-reverse}
.bub{padding:9px 13px;border-radius:18px;font-size:14.5px;line-height:1.5;color:#2a2a29;background:#fff;box-shadow:0 1px 2px rgba(17,17,17,.06);word-break:break-word;overflow-wrap:anywhere;text-align:left}
.bub a{color:#2f7cf6;text-decoration:underline}
.msg.o.first .bub{border-top-left-radius:6px}
.msg.me .bub{background:#111;color:#fff;box-shadow:none}
.msg.me.first .bub{border-top-right-radius:6px}
.msg.me .bub a{color:#9cc4ff}
.bub.img{padding:0;overflow:hidden;background:#e9e9e6;display:block;cursor:zoom-in;border-radius:16px;transition:transform .5s var(--ch-spring)}
.bub.img:active{transform:scale(.97)}
.bub.img img{display:block;width:min(230px,100%);height:auto;max-height:300px;object-fit:cover}
.bub.file{display:flex;align-items:center;gap:10px;min-width:200px;padding:10px 14px 10px 10px;text-decoration:none}
.msg.me .bub.file{background:#111}
.bub.file .fi{width:40px;height:40px;border-radius:12px;background:rgba(17,17,17,.06);display:grid;place-items:center;font-size:19px;flex:0 0 auto}
.msg.me .bub.file .fi{background:rgba(255,255,255,.12)}
.bub.file .fn{min-width:0}
.bub.file b{display:block;font-size:13.5px;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:170px;color:inherit}
.bub.file small{font-size:12px;opacity:.6}
.msg.new.o .mr{animation:inL .55s var(--ch-bounce) both;transform-origin:left bottom}
.msg.new.me .mr{animation:inR .55s var(--ch-bounce) both;transform-origin:right bottom}
@keyframes inL{from{opacity:0;transform:translateY(8px) scale(.85)}}
@keyframes inR{from{opacity:0;transform:translateY(10px) scale(.85)}}

.ch-new{position:absolute;left:50%;bottom:92px;transform:translateX(-50%);display:flex;align-items:center;gap:6px;padding:9px 14px;border-radius:999px;background:#111;color:#fff;font-size:13px;font-weight:700;box-shadow:0 10px 24px rgba(17,17,17,.25);animation:chUp .5s var(--ch-bounce)}
.ch-new svg{width:15px;height:15px}
@keyframes chUp{from{opacity:0;transform:translate(-50%,10px)}}

/* composer */
.ch-f{display:flex;align-items:flex-end;gap:8px;padding:10px 12px calc(12px + env(safe-area-inset-bottom))}
.ch-login{flex:1;display:flex;align-items:center;justify-content:center;height:50px;border-radius:999px;background:#111;color:#fff;font-weight:800;font-size:14.5px;text-decoration:none;transition:transform .5s var(--ch-spring)}
.ch-login:active{transform:scale(.97)}
.ch-att{position:relative}
.ch-plus{width:44px;height:44px;border-radius:50%;display:grid;place-items:center;background:rgba(17,17,17,.05);color:#2a2a29;transition:transform .55s var(--ch-spring),background .2s}
.ch-plus:hover{background:rgba(17,17,17,.09)}
.ch-plus svg{width:20px;height:20px;transition:transform .5s var(--ch-spring)}
.ch-att.open .ch-plus{background:#111;color:#fff}
.ch-att.open .ch-plus svg{transform:rotate(45deg)}
.ch-pop{position:absolute;left:0;bottom:calc(100% + 10px);display:flex;flex-direction:column;gap:2px;padding:6px;border-radius:18px;background:#fff;box-shadow:0 2px 6px rgba(17,17,17,.06),0 20px 44px rgba(17,17,17,.18);transform-origin:left bottom;opacity:0;transform:translateY(6px) scale(.85);pointer-events:none;transition:opacity .16s,transform .5s var(--ch-spring)}
.ch-att.open .ch-pop{opacity:1;transform:none;pointer-events:auto}
.ch-pop button{display:flex;align-items:center;gap:10px;padding:10px 16px 10px 12px;border-radius:12px;font-size:14px;font-weight:700;white-space:nowrap;transition:background .15s}
.ch-pop button:hover{background:rgba(17,17,17,.05)}
.ch-pop svg{width:20px;height:20px}
.ch-in{flex:1;position:relative;display:flex;align-items:flex-end;min-height:44px;border-radius:22px;background:rgba(17,17,17,.05);transition:background .2s,box-shadow .3s}
.ch-in:focus-within{background:#fff;box-shadow:0 0 0 1.5px #111,0 0 0 5px rgba(17,17,17,.06)}
.ch-in textarea{flex:1;border:0;outline:0;background:none;resize:none;padding:11px 4px 11px 16px;font:500 15px/1.45 'Pretendard',-apple-system,'Apple SD Gothic Neo','Malgun Gothic',sans-serif;max-height:120px;color:#111}
.ch-send{flex:0 0 auto;width:36px;height:36px;margin:4px;border-radius:50%;display:grid;place-items:center;background:#111;color:#fff;transition:transform .5s var(--ch-bounce),opacity .2s,background .2s}
.ch-send:disabled{background:rgba(17,17,17,.15);transform:scale(.88)}
.ch-send svg{width:17px;height:17px}
.ch-send.fly svg{animation:fly .5s var(--ch-spring)}
@keyframes fly{40%{transform:translateY(-12px);opacity:0}41%{transform:translateY(12px);opacity:0}}

/* drop overlay */
.ch-drop{position:absolute;inset:8px;z-index:5;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;border-radius:24px;background:rgba(255,255,255,.92);border:2px dashed #111;font-weight:800;font-size:15px;opacity:0;pointer-events:none;transform:scale(.97);transition:opacity .2s,transform .45s var(--ch-spring)}
.ch-drop span{width:52px;height:52px;border-radius:50%;background:#111;color:#fff;display:grid;place-items:center}
.ch-drop svg{width:24px;height:24px}
.ch.dragging .ch-drop{opacity:1;transform:none}

/* photo viewer */
.ch-lb{position:fixed;inset:0;z-index:260;display:grid;place-items:center;padding:24px;background:rgba(0,0,0,.82);opacity:0;pointer-events:none;transition:opacity .25s;cursor:zoom-out}
.ch-lb img{max-width:100%;max-height:100%;border-radius:14px;transform:scale(.9);transition:transform .55s var(--ch-spring)}
.ch-lb.on{opacity:1;pointer-events:auto}
.ch-lb.on img{transform:none}

/* top-bar chat button (inside the page header) */
.chbtn{position:relative}
.chbtn .chb{top:-4px;right:-4px;border-color:#F3F3F1}

@media (max-width:640px){
  .ch{left:0;top:0;bottom:0;width:100%;border-radius:0;transform:translateY(100%)}
  body.ch-open .ch{transform:none}
  .ch-h{padding-top:calc(14px + env(safe-area-inset-top))}
  .ch-fab{left:14px;bottom:calc(14px + env(safe-area-inset-bottom));width:54px;height:54px}
  .ch-list{margin:0 6px}
  .msg .mc{max-width:82%}
}
@media (prefers-reduced-motion:reduce){.ch,.ch-fab,body{transition:none!important}}

/* the hidden attribute always wins over display rules above */
.ch [hidden],.chb[hidden]{display:none!important}
