/* 웃긴단톡 — 단체 대화방. 왼쪽은 방 목록, 가운데는 말풍선, 오른쪽은 많이 본 대화.
   글 하나가 말풍선 하나. 큰 표정은 라벤더 대화 바탕 위 흰 말풍선과 동그란 방 아이콘. */
:root {
  --key: #7c4dff;
  --ink: #1d1b26;
  --sub: #7d7a8c;
  --talk: #e7e1f6;
  --talk2: #ddd5f2;
  --panel: #fff;
  --line: #ebe8f2;
  --a0: #7c4dff; --a1: #ff7a59; --a2: #12b886; --a3: #3b82f6; --a4: #f59f00;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; word-break: keep-all; overflow-wrap: break-word; }
body { margin: 0; color: var(--ink); background: #f6f4fb; font: 15px/1.6 Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--key); outline-offset: 2px; border-radius: 8px; }

.app { display: grid; grid-template-columns: 280px minmax(0, 1fr) 300px; max-width: 1320px; min-height: 100vh; margin: 0 auto; background: var(--panel); box-shadow: 0 0 0 1px var(--line); }

/* 방 목록 */
.rooms { border-right: 1px solid var(--line); padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.me { display: block; padding: 4px 10px 16px; }
.logo { font-size: 22px; font-weight: 800; letter-spacing: -1px; }
.logo::before { content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 8px; border-radius: 50%; background: var(--key); box-shadow: 14px 0 0 var(--a1), 28px 0 0 var(--a2); vertical-align: 2px; margin-right: 38px; }
.room { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; }
.room:hover { background: #f4f1fb; }
.room.on { background: #efeafd; }
.rn { flex: 1; min-width: 0; font-weight: 700; }
.rn small { display: block; font-weight: 400; font-size: 12px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: #ff4d4f; color: #fff; font-size: 11px; text-align: center; }

.av { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 15px; color: #fff; font-weight: 800; font-size: 16px; }
.a0 { background: var(--a0); } .a1 { background: var(--a1); } .a2 { background: var(--a2); } .a3 { background: var(--a3); } .a4 { background: var(--a4); }

/* 대화창 */
.talk { min-width: 0; background: var(--talk); background-image: radial-gradient(rgba(124, 77, 255, .06) 1.5px, transparent 1.5px); background-size: 22px 22px; padding-bottom: 40px; }
.th { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 14px 20px; background: rgba(255, 255, 255, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.th h1, .th .rt { margin: 0; font-size: 18px; font-weight: 700; flex: 1; color: var(--ink); }
.th p { margin: 0; font-size: 13px; color: var(--sub); }
.th b { color: var(--key); }
.back { font-size: 30px; line-height: 1; padding: 0 6px 4px 0; color: var(--sub); }
.empty { padding: 30px 20px; color: var(--sub); }

.msgs { padding: 6px 20px; }
.day { text-align: center; margin: 18px 0 8px; }
.day span { display: inline-block; font-size: 12px; color: #fff; background: rgba(29, 27, 38, .28); padding: 3px 12px; border-radius: 999px; }
.msg { display: flex; align-items: flex-end; gap: 8px; margin: 10px 0; }
.msg .av { align-self: flex-start; }
.mb { min-width: 0; max-width: min(78%, 520px); }
.who { margin: 0 0 4px 2px; font-size: 12px; color: #555; }
.bub { position: relative; display: block; background: #fff; border-radius: 4px 18px 18px 18px; padding: 10px 14px; box-shadow: 0 1px 1px rgba(29, 27, 38, .06); }
a.bub:hover { background: #fbfaff; }
.bub.pic { padding: 6px; }
.bub.pic img { display: block; width: 100%; max-height: 240px; object-fit: cover; border-radius: 2px 14px 14px 14px; }
.bub.pic .bt { display: block; padding: 8px 8px 4px; }
.bt { font-weight: 700; }
.tm { flex: none; font-size: 11px; color: var(--sub); line-height: 1.35; }
.tm b { color: var(--key); margin-right: 3px; }

/* 글 말풍선 */
.msg.big .mb { max-width: min(92%, 720px); }
.bub.doc { padding: 18px 20px 16px; }
.bub.doc h1 { margin: 0 0 12px; font-size: 22px; line-height: 1.4; letter-spacing: -.5px; }
.body { font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; }
.body img { display: block; max-width: 100%; height: auto; margin: 10px 0; border-radius: 12px; }
.body a { color: var(--key); text-decoration: underline; }
.src { margin: 12px 0 0; font-size: 12px; color: var(--sub); }
.src a { text-decoration: underline; }
.replies { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin: 14px 0 0 48px; }
.chipq { max-width: 100%; padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--talk2); font-size: 13px; color: var(--key); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chipq:hover { background: var(--key); color: #fff; }

.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 20px 0; }
.pagination a, .pagination strong, .pagination .gap { min-width: 36px; padding: 6px 12px; text-align: center; border-radius: 999px; background: #fff; font-weight: 700; }
.pagination strong { background: var(--key); color: #fff; }
.pagination .gap { background: none; }

/* 많이 본 대화 */
.pin { border-left: 1px solid var(--line); padding: 18px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.pin h2 { margin: 0 0 10px; font-size: 15px; }
.pin ol { list-style: none; margin: 0; padding: 0; counter-reset: n; }
.pin li { counter-increment: n; }
.pin a { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.pin a::before { content: counter(n); flex: none; width: 18px; font-weight: 800; color: var(--key); }
.pin img { flex: none; width: 46px; height: 46px; border-radius: 10px; object-fit: cover; }
.pin span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note { font-size: 12px; color: var(--sub); margin-top: 18px; }

/* 키워드 링크 묶음 — 대화방 말풍선 안 (광고 표시 없음) */
.pl { margin: 14px 0; font-size: 15px; }
.pl p { margin: 3px 0; }
.pl a { color: var(--key); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.pl-g { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px; margin: 0 0 8px; }
.pl-g a { display: block; }
.body .pl-g img { width: 100%; height: auto; aspect-ratio: 4 / 1; object-fit: cover; margin: 0; border-radius: 10px; }
.pl-q { padding: 10px 14px; background: #f4f0ff; border-radius: 14px; }
.pl-n { padding: 10px 14px; border: 1px solid var(--talk2); border-radius: 14px; }
.bub > .pl:only-child { margin: 0; }

@media (max-width: 1100px) { .app { grid-template-columns: 240px minmax(0, 1fr); } .pin { display: none; } }
@media (max-width: 760px) {
  .app { display: block; }
  .rooms { position: static; height: auto; display: block; padding: 8px 8px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .me { padding: 6px 8px 8px; }
  .rooms nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
  .rooms nav::-webkit-scrollbar { display: none; }
  .room { flex: none; padding: 6px 10px 6px 6px; }
  .room .av { width: 30px; height: 30px; border-radius: 11px; font-size: 13px; }
  .rn small { display: none; }
  .msgs { padding: 4px 10px; }
  .mb { max-width: 80%; }
  .av { width: 34px; height: 34px; border-radius: 13px; font-size: 14px; }
  .bub.doc { padding: 14px; }
  .replies { margin-left: 0; }
}
