:root {
  --green: #15803d;        /* 진한 초록 (대비 ↑) */
  --green-bright: #1ca350; /* 강조 */
  --green-dark: #0f5c2c;
  --green-soft: #e7f6ec;   /* 연한 배경 */
  --bg: #eef2ef;
  --card: #ffffff;
  --line: #d4ddd6;
  --text: #16201a;         /* 거의 검정 — 본문 대비 ↑ */
  --muted: #566159;        /* 보조 텍스트도 충분히 진하게 */
  --danger: #d6336c;
  --shadow: 0 2px 8px rgba(20, 50, 30, .06);
  --shadow-lg: 0 8px 30px rgba(20, 50, 30, .18);
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }  /* hidden 속성이 display:flex 등에 덮이지 않도록 */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Pretendard", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 3px solid var(--green-bright); outline-offset: 2px; border-radius: 6px; }

/* ===== 상단바 ===== */
.topbar {
  background: linear-gradient(135deg, var(--green-bright), var(--green-dark));
  color: #fff;
  padding: 28px 16px 0;
  text-align: center;
  box-shadow: var(--shadow);
}
.topbar h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.tagline { opacity: .95; font-size: 15px; margin-top: 4px; font-weight: 500; }
.tabs { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.tab {
  background: rgba(255,255,255,.14); border: none; color: #fff;
  padding: 12px 24px; font-size: 16px; font-weight: 600; cursor: pointer;
  border-radius: 12px 12px 0 0; transition: .15s;
}
.tab:hover { background: rgba(255,255,255,.26); }
.tab.active { background: var(--bg); color: var(--green-dark); font-weight: 800; }

main { max-width: 820px; margin: 0 auto; padding: 22px 16px 60px; }
.view { display: none; }
.view.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===== 게시판 ===== */
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.cats { display: flex; gap: 8px; flex-wrap: wrap; }
.cat {
  background: var(--card); border: 2px solid var(--line); color: var(--muted);
  padding: 9px 18px; border-radius: 999px; font-size: 15px; font-weight: 600; cursor: pointer; transition: .12s;
}
.cat:hover { border-color: var(--green-bright); color: var(--green-dark); }
.cat.active { background: var(--green); border-color: var(--green); color: #fff; }

.post-list { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.post-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; cursor: pointer; transition: .15s; box-shadow: var(--shadow);
}
.post-card:hover { border-color: var(--green-bright); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.post-card .badge {
  display: inline-block; font-size: 13px; font-weight: 700; background: var(--green-soft); color: var(--green-dark);
  padding: 4px 12px; border-radius: 8px; margin-bottom: 10px;
}
.post-card h3 { font-size: 19px; font-weight: 700; line-height: 1.4; }
.post-card .preview { color: var(--muted); font-size: 15px; margin-top: 6px; }
.post-card .meta { color: var(--muted); font-size: 13.5px; margin-top: 12px; display: flex; gap: 16px; flex-wrap: wrap; font-weight: 500; }

.empty { text-align: center; color: var(--muted); padding: 56px 16px; font-size: 16px; font-weight: 500; }

/* ===== 버튼 ===== */
.btn { border: 2px solid var(--line); background: var(--card); padding: 11px 20px;
  border-radius: 10px; cursor: pointer; font-size: 15px; font-weight: 600; color: var(--text); transition: .12s; }
.btn:hover { border-color: var(--green-bright); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.btn.primary:hover { background: var(--green-dark); border-color: var(--green-dark); }

/* ===== 모달 ===== */
.modal { position: fixed; inset: 0; background: rgba(10,30,18,.55);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; backdrop-filter: blur(2px); }
.modal[hidden] { display: none; }
.modal-box { background: var(--card); border-radius: 18px; padding: 26px; width: 100%; max-width: 560px;
  display: flex; flex-direction: column; gap: 14px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-box h2 { font-size: 22px; font-weight: 800; }
.modal-box input, .modal-box textarea, .modal-box select {
  border: 2px solid var(--line); border-radius: 10px; padding: 13px 14px; font-size: 16px;
  font-family: inherit; width: 100%; color: var(--text); background: #fff; }
.modal-box input::placeholder, .modal-box textarea::placeholder { color: #97a39a; }
.modal-box input:focus, .modal-box textarea:focus, .modal-box select:focus { border-color: var(--green-bright); outline: none; }
.modal-box textarea { resize: vertical; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ===== 상세 ===== */
.detail h2 { font-size: 24px; font-weight: 800; line-height: 1.35; }
.detail .meta { color: var(--muted); font-size: 14px; margin: 8px 0 18px; font-weight: 500; }
.detail .body { white-space: pre-wrap; line-height: 1.8; font-size: 16.5px; }
.detail .like-row { margin: 22px 0; display: flex; gap: 10px; }
.like-btn { background: #fff; border: 2px solid var(--line); border-radius: 999px;
  padding: 10px 20px; cursor: pointer; font-size: 15px; font-weight: 600; transition: .12s; }
.like-btn:hover { border-color: #ff8787; }
.like-btn.on { background: #ffe3e3; border-color: #ff8787; color: #c92a2a; }
.comments { border-top: 2px solid var(--line); margin-top: 18px; padding-top: 18px; }
.comments > strong { font-size: 16px; }
.comment { padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment.blinded .c-text { color: var(--muted); font-style: italic; }
.comment .c-author { font-size: 14px; color: var(--green-dark); font-weight: 700; }
.comment .c-text { font-size: 15.5px; margin-top: 4px; white-space: pre-wrap; line-height: 1.7; }
.comment .c-time { font-size: 12.5px; color: var(--muted); font-weight: 500; }

.report-btn { background: #fff; border: 2px solid var(--line); border-radius: 999px;
  padding: 10px 18px; cursor: pointer; font-size: 15px; font-weight: 600; color: var(--danger); transition: .12s; }
.report-btn:hover { background: #fff0f5; border-color: var(--danger); }
.report-link { background: none; border: none; cursor: pointer; font-size: 12.5px;
  color: var(--muted); margin-left: 8px; padding: 2px 4px; font-weight: 600; border-radius: 6px; }
.report-link:hover { color: var(--danger); }

.comment-form { display: flex; gap: 10px; margin-top: 16px; }
.comment-form input { flex: 1; border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 15px; color: var(--text); }
.comment-form input:focus { border-color: var(--green-bright); outline: none; }

/* ===== 채팅 ===== */
.chat-wrap { display: flex; gap: 16px; height: 72vh; }
.rooms { width: 168px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.rooms h3 { font-size: 15px; font-weight: 800; margin-bottom: 10px; color: var(--green-dark); }
.rooms ul { list-style: none; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.rooms li { padding: 11px 12px; border-radius: 10px; cursor: pointer; font-size: 15px; font-weight: 600; color: var(--muted); transition: .12s; }
.rooms li:hover { background: var(--green-soft); color: var(--green-dark); }
.rooms li.active { background: var(--green); color: #fff; }
.rooms .me { font-size: 13px; color: var(--muted); border-top: 2px solid var(--line); padding-top: 12px; margin-top: 8px; word-break: break-all; font-weight: 500; }
.rooms .me strong { color: var(--green-dark); }

.chat-main { flex: 1; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow); }
.chat-head { display: flex; justify-content: space-between; align-items: center;
  padding: 15px 20px; border-bottom: 2px solid var(--line); font-weight: 800; font-size: 17px; }
.chat-head .count { font-size: 14px; color: var(--muted); font-weight: 600; }
.messages { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; background: #fafcfa; }
.msg .m-author { font-size: 13px; color: var(--green-dark); font-weight: 700; margin-bottom: 3px; }
.msg .m-bubble { background: #fff; border: 1px solid var(--line); padding: 10px 14px; border-radius: 12px;
  display: inline-block; font-size: 15.5px; line-height: 1.5; max-width: 82%; word-break: break-word; }
.msg.mine { text-align: right; }
.msg.mine .m-bubble { background: var(--green); border-color: var(--green); color: #fff; }
.msg .m-time { font-size: 11px; color: var(--muted); margin: 0 6px; font-weight: 500; }
.report-chat { background: none; border: none; cursor: pointer; font-size: 12px; opacity: .4; padding: 0 2px; vertical-align: middle; }
.report-chat:hover { opacity: 1; }
.sys { text-align: center; font-size: 13px; color: var(--muted); font-weight: 500; padding: 2px 0; }
.chat-form { display: flex; gap: 10px; padding: 14px; border-top: 2px solid var(--line); background: #fff; }
.chat-form input { flex: 1; border: 2px solid var(--line); border-radius: 10px; padding: 13px 15px; font-size: 16px; color: var(--text); }
.chat-form input:focus { border-color: var(--green-bright); outline: none; }

/* ===== 관리자 ===== */
.admin-login { display: flex; justify-content: center; padding-top: 40px; }
.login-box { background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 32px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-lg); }
.login-box h2 { font-size: 22px; font-weight: 800; text-align: center; }
.login-box input { border: 2px solid var(--line); border-radius: 10px; padding: 13px 14px; font-size: 16px; font-family: inherit; }
.login-box input:focus { border-color: var(--green-bright); outline: none; }
.login-err { color: var(--danger); font-size: 14px; text-align: center; min-height: 18px; font-weight: 600; }

.admin-h { font-size: 20px; font-weight: 800; margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 14px; margin: 10px 0; font-weight: 500; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; text-align: center; box-shadow: var(--shadow); }
.stat-num { font-size: 34px; font-weight: 800; color: var(--green-dark); line-height: 1.1; }
.stat-label { font-size: 14px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.stat.warn .stat-num { color: var(--danger); }
.stat.ok .stat-num { color: var(--green-bright); }

.adm-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 12px; }
.adm-card.is-hidden { opacity: .7; background: #fbf3f5; border-color: #f0c9d6; }
.adm-card strong { font-size: 17px; display: block; margin: 6px 0; }
.adm-top { display: flex; gap: 8px; align-items: center; }
.rep-cnt { font-size: 14px; font-weight: 700; color: var(--danger); }
.tag-hidden { font-size: 12px; font-weight: 700; background: #ffe3ec; color: var(--danger); padding: 2px 8px; border-radius: 6px; }
.adm-prev { color: var(--muted); font-size: 15px; }
.adm-meta { color: var(--muted); font-size: 13px; margin-top: 8px; font-weight: 500; }
.adm-actions { display: flex; gap: 8px; margin-top: 12px; }
.btn.sm { padding: 7px 14px; font-size: 14px; }
.btn.danger { border-color: #f0a4bd; color: var(--danger); }
.btn.danger:hover { background: #fff0f5; border-color: var(--danger); }

.word-add { display: flex; gap: 10px; }
.word-add input { flex: 1; border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 16px; font-family: inherit; }
.word-add input:focus { border-color: var(--green-bright); outline: none; }
.word-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.word-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--green-soft);
  color: var(--green-dark); border-radius: 999px; padding: 7px 12px; font-size: 14px; font-weight: 600; }
.word-chip button { background: rgba(0,0,0,.12); border: none; color: var(--green-dark); border-radius: 50%;
  width: 20px; height: 20px; cursor: pointer; font-size: 12px; line-height: 1; }
.word-chip button:hover { background: var(--danger); color: #fff; }

/* ===== 반응형 ===== */
@media (max-width: 560px) {
  .topbar h1 { font-size: 25px; }
  main { padding: 16px 12px 48px; }
  .chat-wrap { flex-direction: column; height: auto; }
  .rooms { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .rooms h3 { width: 100%; }
  .rooms ul { flex-direction: row; flex-wrap: wrap; }
  .rooms .me { width: 100%; border-top: none; padding-top: 0; margin-top: 0; }
  .messages { height: 52vh; }
  .post-card h3 { font-size: 18px; }
}
