/* 커뮤니티(게시판·채팅) 공통 */
.wrap { max-width: 820px; }
.muted { color: var(--muted); }
.ctabs { display: flex; gap: 6px; margin: 2px 0 12px; }
.ctabs a {
  text-decoration: none; color: var(--muted); font-weight: 700; font-size: 15px;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel);
}
.ctabs a[aria-current="page"] { color: var(--bg); background: var(--text); border-color: var(--text); }
#authbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: 13px; padding: 8px 12px; margin-bottom: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-height: 44px;
}
#authbar .acts { display: flex; gap: 4px; }
.badge { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: rgba(110,168,254,.18); color: var(--accent); }
.badge.red { background: rgba(255,92,92,.16); color: var(--red); }

.btn {
  font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; border-radius: 9px;
  padding: 8px 14px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0d1320; }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.linkbtn { font: inherit; font-size: 12.5px; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.linkbtn:hover { color: var(--text); background: var(--panel-2); }
.linkbtn.danger:hover { color: var(--red); }

input, textarea, select {
  font: inherit; font-size: 14.5px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.6; }

/* 말머리 */
.tag { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; margin-right: 6px; vertical-align: 1px; white-space: nowrap; }
.tag.t-정보 { background: rgba(57,135,229,.2); color: #7fb2f0; }
.tag.t-질문 { background: rgba(201,133,0,.2); color: #f0b54a; }
.tag.t-자유 { background: rgba(144,133,233,.2); color: #b3aaf3; }
.tag.t-포트폴리오 { background: rgba(25,158,112,.22); color: #4fd3a3; }

/* 글 목록 */
.listbar { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 10px; }
.listbar .chips { margin: 0; flex: 1; }
.search { display: flex; gap: 6px; margin-bottom: 10px; }
.search input { flex: 1; padding: 7px 10px; font-size: 13.5px; }
.posts { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.posts li + li { border-top: 1px solid var(--line); }
.posts a { display: block; padding: 11px 14px; text-decoration: none; color: var(--text); }
.posts a:hover { background: rgba(255,255,255,.03); }
.posts .ttl { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.posts .cc { color: var(--accent); font-size: 12.5px; font-weight: 700; margin-left: 4px; }
.posts .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.meta .nick, .nick { color: var(--text); font-weight: 600; }
.meta .nick { color: #c4c8cf; }
.nick.gone { color: var(--muted); font-weight: 400; }
.empty { color: var(--muted); text-align: center; padding: 34px 12px; font-size: 13.5px; }
.pager { display: flex; justify-content: center; gap: 4px; margin-top: 12px; flex-wrap: wrap; }
.pager a { min-width: 34px; text-align: center; padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: 13px; }
.pager a[aria-current="page"] { background: var(--panel-2); color: var(--text); font-weight: 700; }

/* 글 보기 */
.post { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.post h1 { font-size: 19px; margin: 0 0 6px; overflow-wrap: anywhere; }
.post .meta { font-size: 12.5px; color: var(--muted); padding-bottom: 12px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.post .meta .sp { flex: 1; }
.post .body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.75; padding: 14px 0 4px; }
.back { display: inline-block; margin-bottom: 10px; font-size: 13px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--text); }
.comments { margin-top: 14px; }
.comments h2 { font-size: 14px; margin: 0 0 8px; }
.cmt { padding: 10px 2px; border-bottom: 1px solid var(--line); }
.cmt .meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.cmt .meta .sp { flex: 1; }
.cmt .txt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; margin-top: 3px; }
.cform { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.cform textarea { min-height: 44px; }

/* 사진 */
.pimg { display: block; margin: 10px 0 0; }
.pimg img { display: block; max-width: 100%; max-height: 80vh; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); }
.hasimg { font-size: 12px; }
.photos { display: grid; gap: 6px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs:empty { display: none; }
.th { position: relative; width: 84px; height: 84px; }
.th img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.th button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--red); color: #fff; font-size: 14px; line-height: 22px; padding: 0; cursor: pointer; }
.addph { justify-self: start; display: inline-flex; align-items: center; gap: 6px; }
.addph small { color: var(--muted); font-weight: 500; }
.photos .fine { margin: 0; }

/* 글쓰기 */
.wform { display: grid; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.wform .row { display: flex; gap: 8px; }
.wform select { width: auto; flex: none; }
.wform textarea { min-height: 280px; }
.wform .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.rules { font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin-bottom: 12px; }
.rules b { color: var(--text); }

/* 채팅 */
.chat { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; height: calc(100dvh - var(--nav-h) - 200px); min-height: 360px; }
.chat .head { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.chat .head b { color: var(--green); }
.msgs { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 82%; align-self: flex-start; }
.msg .who { font-size: 12px; color: var(--muted); margin: 0 0 2px 4px; }
.msg .row { display: flex; align-items: flex-end; gap: 6px; }
.msg .bub { background: var(--panel-2); padding: 7px 11px; border-radius: 4px 14px 14px 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.msg .t { font-size: 10.5px; color: var(--muted); flex: none; }
.msg .tools { display: none; }
.msg.open .tools { display: inline-flex; }
@media (hover: hover) { .msg:hover .tools { display: inline-flex; } }
.msg .bub { cursor: pointer; }
.msg .tools .linkbtn { font-size: 12px; padding: 3px 6px; }
.msg .tools .linkbtn.danger { color: var(--red); }
.msg.me { align-self: flex-end; }
.msg.me .who { display: none; }
.msg.me .row { flex-direction: row-reverse; }
.msg.me .bub { background: #2b4a7a; border-radius: 14px 4px 14px 14px; }
.chat .cbar { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat .cbar[hidden] { display: none; }
.cinput {
  flex: 1; min-width: 0; min-height: 42px; max-height: 110px; overflow-y: auto;
  font-size: 14.5px; line-height: 1.45; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px;
  white-space: pre-wrap; overflow-wrap: anywhere; outline: none; cursor: text;
}
.cinput:focus { border-color: var(--accent); }
.cinput:empty::before { content: attr(data-ph); color: var(--muted); pointer-events: none; }
.chat .gate { padding: 12px; border-top: 1px solid var(--line); text-align: center; font-size: 13px; color: var(--muted); }

/* 모달·알림 */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.modal { position: relative; width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px 18px 16px; }
.modal h2 { font-size: 18px; margin: 0 0 6px; }
.modal .muted { font-size: 13px; margin: 0 0 14px; }
.modal .x { position: absolute; top: 8px; right: 10px; background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
.modal hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0 8px; }
.providers { display: grid; gap: 8px; }
.prov { font: inherit; font-weight: 700; font-size: 14.5px; padding: 11px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12); cursor: pointer; }
.fine { font-size: 11.5px; color: var(--muted); margin: 12px 0 0; }
.nickform { display: flex; gap: 8px; }
.nickform input { min-width: 0; }
.nickform .btn { flex: none; white-space: nowrap; }
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60;
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 13.5px; padding: 10px 16px; border-radius: 10px;
  transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* 아이폰은 글자 16px 미만 입력칸을 누르면 화면을 확대함 → 터치 기기에선 16px */
@media (hover: none) and (pointer: coarse) {
  input, textarea, select, .search input, .nickform input, .cinput { font-size: 16px; }
}

/* 정렬 · 조회수 · 좋아요 */
.sortbar { display: flex; gap: 2px; margin: 0 0 8px; font-size: 12.5px; }
.sortbar a { color: var(--muted); text-decoration: none; padding: 4px 9px; border-radius: 7px; }
.sortbar a[aria-pressed="true"] { color: var(--text); background: var(--panel-2); font-weight: 700; }
.posts .meta .lk { color: #ff7b8a; font-weight: 600; }
.likebar { display: flex; justify-content: center; padding: 18px 0 6px; }
.likebtn { font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 20px; display: inline-flex; align-items: center; gap: 6px; }
.likebtn .h { font-size: 17px; color: #ff7b8a; line-height: 1; }
.likebtn[aria-pressed="true"] { border-color: #ff7b8a; background: rgba(255,123,138,.12); }
.likebtn b { font-variant-numeric: tabular-nums; }
