:root {
  --community-blue: #2563eb;
  --community-blue-dark: #153f91;
  --community-green: #0f766e;
  --community-ink: #0f172a;
  --community-muted: #64748b;
  --community-line: #dce4ef;
  --community-page: #f4f7fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--community-page);
  color: var(--community-ink);
  font-family: Pretendard, "Noto Sans KR", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  cursor: pointer;
}

.community-header {
  border-bottom: 1px solid var(--community-line);
  background: #fff;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1280px, calc(100% - 36px));
  min-height: 68px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  width: 43px;
  height: 43px;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand small {
  margin-top: 2px;
  color: #94a3b8;
  font-size: 9px;
  font-weight: 700;
}

.header-actions,
.community-tools,
.section-head,
.side-heading,
.post-top,
.post-meta,
.post-actions,
.dialog-head,
.dialog-actions,
.writing-options,
.detail-toolbar,
.comment-head {
  display: flex;
  align-items: center;
}

.header-actions {
  gap: 7px;
}

.community-user-state {
  margin-right: 4px;
  color: var(--community-muted);
  font-size: 11px;
  font-weight: 700;
}

.header-link {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: #334155;
  font-size: 20px;
}

.primary-button,
.secondary-button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 7px;
  font-weight: 800;
}

.primary-button {
  border: 1px solid var(--community-blue);
  background: var(--community-blue);
  color: #fff;
}

.secondary-button {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
}

.community-page {
  width: min(1280px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 60px;
}

.community-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  padding: 6px 0 28px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--community-blue);
  font-size: 12px;
  font-weight: 900;
}

.community-intro h1 {
  margin: 0;
  font-size: 34px;
}

.community-intro > div:first-child > p:last-child {
  margin: 10px 0 0;
  color: var(--community-muted);
  font-size: 14px;
}

.community-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  min-width: 330px;
  border: 1px solid var(--community-line);
  border-radius: 8px;
  background: #fff;
}

.community-stats div {
  padding: 15px 18px;
  border-right: 1px solid var(--community-line);
}

.community-stats div:last-child {
  border-right: 0;
}

.community-stats strong,
.community-stats span {
  display: block;
}

.community-stats strong {
  margin-bottom: 4px;
  font-size: 21px;
}

.community-stats span {
  color: var(--community-muted);
  font-size: 11px;
}

.community-tools {
  gap: 9px;
  padding: 13px;
  border: 1px solid var(--community-line);
  border-radius: 8px;
  background: #fff;
}

.search-field {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 220px;
  height: 42px;
  padding: 0 11px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  color: #94a3b8;
}

.search-field:focus-within {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-field input {
  width: 100%;
  height: 100%;
  padding: 0 8px;
  border: 0;
  outline: 0;
}

.category-tabs {
  display: flex;
  gap: 3px;
}

.category-tabs button {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.category-tabs button.active {
  background: #eff6ff;
  color: var(--community-blue-dark);
}

.community-tools > select {
  height: 42px;
  padding: 0 34px 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: #334155;
}

.community-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 16px;
  margin-top: 16px;
}

.feed-panel,
.side-section {
  border: 1px solid var(--community-line);
  border-radius: 8px;
  background: #fff;
}

.section-head {
  justify-content: space-between;
  gap: 18px;
  min-height: 74px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--community-line);
}

.section-head h2,
.side-heading h2 {
  margin: 0;
  font-size: 16px;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--community-muted);
  font-size: 11px;
}

.section-head > span,
.side-heading > span {
  color: var(--community-muted);
  font-size: 11px;
  white-space: nowrap;
}

.feed-status {
  display: grid;
  justify-items: end;
  gap: 3px;
}

.feed-status span {
  color: #0f766e;
  font-size: 10px;
  font-weight: 800;
}

.feed-status strong {
  color: var(--community-muted);
  font-size: 11px;
}

.post-item {
  position: relative;
  padding: 20px 18px;
  border-bottom: 1px solid #e8edf4;
}

.post-item:hover {
  background: #fbfdff;
}

.post-item:last-child {
  border-bottom: 0;
}

.post-top {
  justify-content: space-between;
  gap: 12px;
}

.post-category {
  padding: 5px 8px;
  border-radius: 5px;
  background: #eff6ff;
  color: var(--community-blue-dark);
  font-size: 11px;
  font-weight: 800;
}

.post-time {
  color: #94a3b8;
  font-size: 11px;
}

.post-main-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--community-ink);
  text-align: left;
}

.post-title {
  display: block;
  margin: 11px 0 7px;
  font-size: 17px;
  line-height: 1.45;
}

.post-main-button:hover .post-title {
  color: var(--community-blue);
}

.post-preview {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

.post-item > .post-actions {
  position: absolute;
  right: 14px;
  bottom: 13px;
  padding-left: 12px;
  background: linear-gradient(90deg, rgba(255,255,255,0), #fff 22%);
}

.post-meta,
.post-actions {
  gap: 10px;
  color: #64748b;
  font-size: 11px;
}

.post-actions button {
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 11px;
}

.post-actions button.active {
  color: var(--community-blue);
  font-weight: 800;
}

.empty-feed {
  display: grid;
  min-height: 360px;
  padding: 28px;
  place-content: center;
  color: var(--community-muted);
  text-align: center;
}

.empty-feed strong {
  color: #334155;
}

.empty-feed p {
  margin: 7px 0 0;
  font-size: 12px;
}

.empty-feed.login-gate .primary-button {
  display: inline-flex;
  margin: 18px auto 0;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.community-side {
  display: grid;
  align-content: start;
  gap: 12px;
}

.side-section {
  padding: 17px;
}

.side-heading {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}

.topic-ranking {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rank;
}

.topic-ranking li {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  color: #334155;
  font-size: 12px;
  counter-increment: rank;
}

.topic-ranking li::before {
  content: counter(rank);
  width: 20px;
  color: var(--community-blue);
  font-weight: 900;
  text-align: center;
}

.topic-ranking button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  padding: 7px 4px;
  border: 0;
  background: transparent;
  color: #334155;
  font: inherit;
  font-weight: 700;
  text-align: left;
}

.topic-ranking button small {
  color: #94a3b8;
  font-size: 10px;
}

.topic-ranking button:hover {
  color: var(--community-blue);
}

.community-rules {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 18px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.55;
}

.post-dialog,
.detail-dialog,
.action-dialog {
  width: min(700px, calc(100% - 28px));
  max-height: calc(100vh - 30px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  color: var(--community-ink);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.detail-dialog {
  width: min(780px, calc(100% - 28px));
}

.action-dialog {
  width: min(520px, calc(100% - 28px));
}

.post-dialog::backdrop,
.detail-dialog::backdrop,
.action-dialog::backdrop {
  background: rgba(15, 23, 42, 0.56);
}

.dialog-head {
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--community-line);
}

.dialog-head p {
  margin: 0 0 4px;
  color: var(--community-blue);
  font-size: 11px;
  font-weight: 800;
}

.dialog-head h2 {
  margin: 0;
  font-size: 21px;
}

.dialog-guide {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.65;
}

.dialog-body label small {
  color: #94a3b8;
  font-weight: 500;
}

.dialog-body {
  display: grid;
  gap: 15px;
  max-height: calc(100vh - 190px);
  padding: 20px;
  overflow-y: auto;
}

.dialog-body label > span {
  display: block;
  margin-bottom: 7px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.dialog-body input,
.dialog-body select,
.dialog-body textarea,
.comment-form textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  outline: 0;
  background: #fff;
}

.dialog-body input,
.dialog-body select {
  height: 44px;
  padding: 0 12px;
}

.dialog-body textarea,
.comment-form textarea {
  padding: 12px;
  resize: vertical;
}

.dialog-body input:focus,
.dialog-body select:focus,
.dialog-body textarea:focus,
.comment-form textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.writing-options,
.dialog-actions {
  justify-content: space-between;
  gap: 10px;
}

.danger-button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #c9362b;
  border-radius: 7px;
  background: #c9362b;
  color: #fff;
  font-weight: 800;
}

.danger-button.restore-button {
  border-color: #177245;
  background: #177245;
}

.writing-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #475569;
  font-size: 12px;
}

.writing-options > span {
  color: #94a3b8;
  font-size: 11px;
}

.form-error {
  min-height: 18px;
  margin: -4px 0 0;
  color: #b42318;
  font-size: 11px;
  font-weight: 700;
}

.dialog-actions {
  justify-content: flex-end;
  padding: 13px 20px;
  border-top: 1px solid var(--community-line);
  background: #f8fafc;
}

.detail-article {
  max-height: calc(100vh - 30px);
  overflow-y: auto;
}

.detail-toolbar {
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--community-line);
}

.detail-toolbar > div {
  display: flex;
  gap: 6px;
}

.detail-toolbar-actions > button:not(.icon-button):not(.delete-button) {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.detail-toolbar-actions > button:disabled {
  opacity: .55;
}

.delete-button {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fff;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 800;
}

.delete-button:hover {
  background: #fef2f2;
}

.detail-main {
  padding: 24px 22px;
}

.detail-main h2 {
  margin: 12px 0 10px;
  font-size: 25px;
}

.detail-author {
  margin: 0 0 22px;
  color: var(--community-muted);
  font-size: 12px;
}

.detail-content {
  min-height: 150px;
  margin: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.85;
  white-space: pre-wrap;
}

.moderation-badge {
  display: inline-flex;
  min-height: 20px;
  margin-left: 6px;
  padding: 0 7px;
  align-items: center;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  vertical-align: middle;
}

.moderation-badge.hidden {
  background: #fff0ee;
  color: #a1261b;
}

.moderation-badge.reported {
  background: #fff7df;
  color: #8a5700;
}

.post-item.is-hidden,
.detail-article.is-hidden,
.comment-item.is-hidden {
  background: #fffafa;
}

.post-item.is-hidden {
  border-left: 3px solid #d76055;
}

.hidden-notice {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #f0b4ae;
  border-radius: 6px;
  background: #fff3f1;
  color: #7e211a;
  font-size: 12px;
}

.hidden-notice span {
  color: #985047;
}

.moderation-filter-button.active {
  border-color: #d89b28;
  background: #fff7df;
  color: #7d4e00;
}

.detail-reactions {
  display: flex;
  gap: 7px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e8edf4;
}

.detail-reactions button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.detail-reactions button.active {
  border-color: #93c5fd;
  background: #eff6ff;
  color: var(--community-blue-dark);
}

.comment-section {
  padding: 20px 22px 24px;
  border-top: 8px solid var(--community-page);
}

.comment-section h3 {
  margin: 0 0 14px;
  font-size: 15px;
}

.comment-list {
  display: grid;
  gap: 10px;
}

.empty-comments {
  padding: 24px 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  color: var(--community-muted);
  font-size: 12px;
  text-align: center;
}

.comment-item {
  position: relative;
  padding: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.comment-delete {
  position: absolute;
  right: 10px;
  bottom: 9px;
  padding: 3px 5px;
  border: 0;
  background: transparent;
  color: #a34840;
  font-size: 10px;
}

.comment-head {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  font-size: 11px;
}

.comment-head span {
  color: #94a3b8;
}

.comment-item p {
  margin: 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.comment-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 9px;
}

.comment-actions button {
  padding: 4px 7px;
  border: 1px solid #d8e0eb;
  border-radius: 5px;
  background: #fff;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
}

.comment-actions button:disabled {
  opacity: .55;
}

.comment-actions .danger-text {
  border-color: #f0c7c3;
  color: #a1261b;
}

.comment-form {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 8px;
  margin-top: 13px;
}

.comment-form-actions {
  display: grid;
  gap: 8px;
}

.comment-form-actions label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 11px;
}

.login-required {
  margin: 14px 0 0;
  padding: 13px;
  border: 1px solid #dbe3ee;
  border-radius: 6px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  text-align: center;
}

.community-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  max-width: min(380px, calc(100% - 30px));
  padding: 13px 16px;
  border: 1px solid #a7d8c8;
  border-radius: 7px;
  background: #ecfdf5;
  color: #0f5e4f;
  box-shadow: 0 14px 40px rgba(15,23,42,.18);
  font-size: 12px;
  font-weight: 800;
}

.community-toast.error {
  border-color: #f0b4ae;
  background: #fff3f1;
  color: #a1261b;
}
.community-toast.review {
  border-color: #f0c768;
  color: #6f4700;
  background: #fff8df;
}

.empty-feed.error strong { color: #a1261b; }
.empty-feed .secondary-button { margin: 14px auto 0; }

.comment-form textarea {
  min-height: 72px;
}

.comment-form button {
  align-self: stretch;
}

@media (max-width: 980px) {
  .community-intro {
    align-items: flex-start;
    flex-direction: column;
  }
  .community-stats {
    width: 100%;
  }
  .community-tools {
    align-items: stretch;
    flex-wrap: wrap;
  }
  .search-field {
    flex-basis: 100%;
  }
  .category-tabs {
    flex: 1;
    overflow-x: auto;
  }
  .category-tabs button {
    white-space: nowrap;
  }
  .community-layout {
    grid-template-columns: 1fr;
  }
  .community-side {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .header-inner,
  .community-page {
    width: calc(100% - 22px);
  }
  .brand small {
    display: none;
  }
  .community-page {
    padding-top: 22px;
  }
  .community-intro h1 {
    font-size: 28px;
  }
  .community-stats {
    min-width: 0;
  }
  .community-stats div {
    padding: 12px;
  }
  .community-tools > select {
    width: 100%;
  }
  .community-side {
    grid-template-columns: 1fr;
  }
  .post-footer {
    align-items: flex-start;
    flex-direction: column;
  }
  .post-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .post-item > .post-actions {
    position: static;
    margin-top: 9px;
    padding: 0;
    background: transparent;
  }
  .comment-form {
    grid-template-columns: 1fr;
  }
  .comment-form button {
    min-height: 44px;
  }
  .community-user-state { display: none; }
  .moderation-filter-button {
    position: fixed;
    right: 14px;
    bottom: 74px;
    z-index: 80;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .16);
  }
  .detail-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .detail-toolbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}
