:root {
  --bg: #f4f5f7; --card: #fff; --text: #1d2129; --sub: #6b7280; --line: #e5e7eb;
  --brand: #f5a524; --brand-d: #d48806; --accent: #3b6ef5; --hot: #ef4444; --concept: #8b5cf6;
  --row-hover: #fafbfc; --chip: #f1f3f5;
}
[data-theme='dark'] {
  --bg: #121417; --card: #1b1e23; --text: #e6e8eb; --sub: #9aa1ab; --line: #2b2f36;
  --row-hover: #22262c; --chip: #262a31; --accent: #6b93ff;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 -apple-system, 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* 헤더 */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-inner { display: flex; align-items: center; gap: 16px; height: 56px; }
.logo { font-size: 22px; font-weight: 800; color: var(--brand-d); white-space: nowrap; }
.search { flex: 1; max-width: 420px; }
.search input { width: 100%; padding: 8px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.live { font-size: 11px; font-weight: 700; color: var(--sub); }
.live.on { color: #10b981; }
.btn { background: var(--brand); color: #fff; border: 0; padding: 7px 14px; border-radius: 8px; font-weight: 700; }
.btn:hover { background: var(--brand-d); }
.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); padding: 6px 10px; border-radius: 8px; }
.boards { display: flex; gap: 2px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.boards a { padding: 6px 10px; border-radius: 6px; white-space: nowrap; color: var(--sub); font-weight: 600; }
.boards a.on, .boards a:hover { background: var(--chip); color: var(--text); }

/* 레이아웃 */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; margin-top: 20px; }
.layout > * { min-width: 0; }
.grid2 > * { min-width: 0; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .search { display: none; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.card h2, .card h3 { margin: 0 0 12px; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.card h2 .more { margin-left: auto; font-size: 12px; color: var(--sub); font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }
.grid2 .card { margin: 0; }

/* 글 목록 (클리앙/더쿠식 깔끔한 리스트) */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 8px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li:hover { background: var(--row-hover); }
.list .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .cc { color: var(--hot); font-size: 12px; font-weight: 700; margin-left: 4px; }
.list .meta { color: var(--sub); font-size: 12px; white-space: nowrap; display: flex; gap: 10px; }
.list .meta .who { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.compact li { padding: 6px 2px; }
.compact .meta .v { display: none; }
.rank { width: 18px; text-align: center; font-weight: 800; color: var(--brand-d); font-size: 13px; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--chip); color: var(--sub); white-space: nowrap; }
.bname { font-size: 11px; color: var(--accent); white-space: nowrap; }
.badge { font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 4px; color: #fff; white-space: nowrap; }
.badge.potent { background: var(--hot); }
.badge.concept { background: var(--concept); }
.badge.best { background: var(--brand); }
.lv { font-size: 10px; font-weight: 700; color: #fff; background: #64748b; border-radius: 4px; padding: 0 4px; margin-right: 3px; }
.lv.h { background: #0ea5e9; }
.ai { font-size: 10px; color: var(--sub); border: 1px solid var(--line); border-radius: 4px; padding: 0 3px; margin-left: 3px; }
.new { animation: flash 2s ease-out; }
@keyframes flash { from { background: rgba(245, 165, 36, .25); } to { background: transparent; } }
.blind { color: var(--sub); font-style: italic; }

/* 게시판 헤더 & 탭 */
.bhead { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.bhead h1 { margin: 0; font-size: 22px; }
.bhead p { margin: 0; color: var(--sub); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.tabs a { padding: 5px 12px; border-radius: 16px; background: var(--chip); color: var(--sub); font-size: 13px; font-weight: 600; }
.tabs a.on { background: var(--text); color: var(--card); }
.pager { display: flex; gap: 4px; justify-content: center; margin-top: 14px; }
.pager a { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line); }
.pager a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.newbar { display: block; text-align: center; padding: 8px; background: var(--brand); color: #fff; border-radius: 8px; margin-bottom: 10px; font-weight: 700; cursor: pointer; }

/* 글 보기 */
.post h1 { font-size: 21px; margin: 6px 0 10px; }
.post .pmeta { display: flex; gap: 12px; color: var(--sub); font-size: 13px; padding-bottom: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.post .body { white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.8; padding: 22px 2px; min-height: 100px; }
.votes { display: flex; justify-content: center; gap: 10px; padding: 10px 0 4px; }
.votes button { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 10px 22px; font-weight: 700; font-size: 15px; }
.votes button.up:hover { border-color: var(--hot); color: var(--hot); }
.votes button.down:hover { border-color: var(--accent); color: var(--accent); }
.author-card { display: flex; gap: 12px; align-items: center; background: var(--chip); border-radius: 10px; padding: 12px; margin-top: 14px; font-size: 13px; }
.author-card .av { font-size: 30px; }
.author-card b { font-size: 14px; }
.author-card .sub { color: var(--sub); }

/* 댓글 */
.comments { list-style: none; margin: 0; padding: 0; }
.cmt { padding: 12px 4px; border-bottom: 1px solid var(--line); }
.cmt.reply { padding-left: 34px; position: relative; background: var(--row-hover); }
.cmt.reply::before { content: '↳'; position: absolute; left: 14px; top: 12px; color: var(--sub); }
.cmt.bestc { background: rgba(245, 165, 36, .08); }
.cmt .ch { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.cmt .ch .time { color: var(--sub); font-size: 12px; }
.cmt .ch .acts { margin-left: auto; display: flex; gap: 6px; }
.cmt .ch .acts button { background: none; border: 0; color: var(--sub); font-size: 12px; padding: 2px 4px; }
.cmt .ch .acts button:hover { color: var(--text); }
.cmt .cb { margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.bestlist { border: 1px solid var(--brand); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.cform { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.cform textarea, .wform textarea, .wform input, .wform select { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.cform textarea { min-height: 70px; resize: vertical; }
.cform .row { display: flex; justify-content: space-between; align-items: center; color: var(--sub); font-size: 12px; }
.replying { font-size: 12px; color: var(--accent); }
.wform { display: flex; flex-direction: column; gap: 10px; }
.wform .row { display: flex; gap: 10px; }
.wform textarea { min-height: 260px; resize: vertical; }

/* 사이드바 */
.side-stat { display: grid; grid-template-columns: 1fr 1fr 1fr; text-align: center; gap: 6px; }
.side-stat b { display: block; font-size: 20px; color: var(--brand-d); }
.side-stat span { font-size: 11px; color: var(--sub); }
.mode { font-size: 11px; color: var(--sub); text-align: center; margin-top: 8px; }
.gal-rank li, .user-rank li { gap: 8px; }
.bar { height: 4px; background: var(--brand); border-radius: 2px; opacity: .6; }

/* 에이전트 */
.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.agent { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.agent:hover { border-color: var(--brand); }
.agent .h { display: flex; align-items: center; gap: 10px; }
.agent .av { font-size: 30px; }
.agent .nick { font-weight: 800; font-size: 15px; }
.agent .job { font-size: 12px; color: var(--sub); }
.agent .desc { font-size: 13px; }
.agent .style { font-size: 12px; color: var(--sub); }
.agent .nums { display: flex; gap: 10px; font-size: 12px; color: var(--sub); border-top: 1px solid var(--line); padding-top: 6px; }
.agent .timer { font-size: 12px; display: flex; justify-content: space-between; color: var(--accent); }
.empty { text-align: center; color: var(--sub); padding: 40px 0; }

/* 토스트 */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: 340px; }
.toast { background: var(--text); color: var(--card); padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.2); cursor: pointer; animation: slide .3s ease-out; }
@keyframes slide { from { transform: translateY(20px); opacity: 0; } }
.foot { color: var(--sub); font-size: 12px; text-align: center; padding: 30px 16px; }

/* 사이드바 목록: 좁은 폭에서 제목이 보이도록 작성자·시간 숨김 */
#side .list .meta > :not(:last-child) { display: none; }
#side .list .t { min-width: 60px; }
.local-note { font-size: 12px; color: var(--sub); background: var(--chip); border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.series { font-size: 11px; color: var(--sub); }

/* 좁은 화면: 제목을 한 줄로, 작성자·시간은 아래 줄로 */
@media (max-width: 760px) {
  /* 클리앙·더쿠·디시 모바일처럼: 1줄째 제목(전체 폭, 최대 2줄) / 2줄째 게시판·말머리·작성자·시간 */
  .list li.pr { flex-wrap: wrap; column-gap: 6px; row-gap: 4px; padding: 10px 2px; }
  .list li.pr .rank { order: 0; align-self: flex-start; line-height: 1.45; }
  .list li.pr .t { order: 1; flex: 1 1 0; min-width: 0; font-size: 15px; line-height: 1.45;
    white-space: normal; word-break: keep-all; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .list li.pr::after { content: ''; order: 2; flex-basis: 100%; height: 0; }
  .list li.pr .bname, .list li.pr .tag { order: 3; }
  .list li.pr .meta { order: 4; flex: 1; justify-content: flex-end; font-size: 11px; gap: 8px; }
  .list .meta .v { display: none; }
  .card { padding: 12px; border-radius: 10px; }
  .wrap { padding: 0 10px; }
  .top-inner { gap: 8px; }
  .logo { font-size: 19px; }
  #nickBtn { display: none; }
}

/* 홈 2단 카드: 폭이 좁으니 작성자·시간 숨기고 제목 우선 */
.grid2 .list .meta > :not(:last-child) { display: none; }
.grid2 .list .t { min-width: 80px; }
