:root {
  --bg: #ffffff;
  --surface: #fafafa;
  --ink: #111113;
  --muted: #6b6b70;
  --border: #e6e6e9;
  --border-strong: #111113;
  --hover: #f4f4f5;
  --tw-gradient-to: #2961db;
  --tw-gradient-from: #70b7f3;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}

/* ---------- Dark mode ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f10;
    --surface: #17171a;
    --ink: #f2f2f3;
    --muted: #8f8f96;
    --border: #2a2a2e;
    --border-strong: #f2f2f3;
    --hover: #1f1f23;
  }
}

/* 수동 토글용 (JS로 html/body에 data-theme="dark" 또는 "light" 부여) */
[data-theme="dark"] {
  --bg: #0f0f10;
  --surface: #17171a;
  --ink: #f2f2f3;
  --muted: #8f8f96;
  --border: #2a2a2e;
  --border-strong: #f2f2f3;
  --hover: #1f1f23;
}

[data-theme="light"] {
  --bg: #ffffff;
  --surface: #fafafa;
  --ink: #111113;
  --muted: #6b6b70;
  --border: #e6e6e9;
  --border-strong: #111113;
  --hover: #f4f4f5;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Noto Sans KR', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.theme-icon {
  display: block;
  transform: rotate(0deg);
  transition: transform 0.2s ease;
}

[data-theme="dark"] .theme-icon {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.001ms !important;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

.icon-lock {
  display: block;
  color: var(--ink);
}

.board-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 36px 24px;
}

/* ---------- Header ---------- */
.board-header {
  margin-bottom: 48px;
}

.header-buttons {
  display: flex;
  gap: 8px;
}

.header-buttons a,
.header-buttons button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.header-buttons a:hover,
.header-buttons button:hover {
  background: var(--hover);
  border-color: var(--border-strong);
}

.admin-link {
  margin-left: auto;
}

.admin-link:hover {
  background: var(--hover);
  border-color: var(--border-strong);
}

.tape-title {
  display: block;
  transform: none;
  background: none;
  box-shadow: none;
  padding: 0;
  margin-top: 8px;
}

.tape-title .logo {
  font-family: 'Poppins Bold Italic', 'Noto Sans KR', sans-serif;
  font-size: 28px;
  text-align: left;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  background-image: linear-gradient(to right, var(--tw-gradient-stops));
  margin-right: 4px;
}

.tape-title a {
  transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.tape-title a:hover {
  /* text-decoration: underline;
  text-decoration-color: var(--tw-gradient-from);
  text-decoration-thickness: 3px; */
  opacity: 0.85;
}

.tape-title .text {
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 700;
  font-size: 24px;
  color: var(--ink);
}

.board-header .sub {
  font-family: 'Noto Sans KR', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  text-shadow: none;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
}

#filter-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar input[type="text"] {
  font-family: 'Noto Sans KR', monospace;
  font-size: 13px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  min-width: 220px;
  outline: none;
}

.toolbar input[type="text"]:focus {
  border-color: var(--border-strong);
}

.btn {
  font-family: 'Noto Sans KR', monospace;
  font-size: 12px;
  padding: 9px 16px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}

.btn:hover {
  background: var(--hover);
}

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

.btn-primary:hover {
  background: var(--ink);
  opacity: 0.85;
}

/* ---------- List (formerly card-grid of pins, now a numbered log) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  counter-reset: entry;
}

.pin-card {
  counter-increment: entry;
  position: relative;
  background: var(--surface);
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 16px 56px;
  transform: none;
  box-shadow: none;
  transition: background 0.12s ease;
  text-decoration: none;
  color: var(--ink);
  display: block;
}

.pin-card:hover {
  background: var(--hover);
  transform: none;
  box-shadow: none;
}

.pin-card::before {
  content: attr(data-id);
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translate(0, -50%);
  width: 36px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-family: 'Noto Sans KR', monospace;
  font-size: 12px;
  color: var(--muted);
}

.pin-card.new::before {
  background: none;
}

.pin-card .p-wrap {
  display: flex;
  margin-bottom: 6px;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  vertical-align: middle;
}

.pin-card .p-category {
  display: inline-flex;
  font-family: 'Noto Sans KR', monospace;
  font-size: 10px;
  margin-top: 3px;
  padding: 2px 6px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.pin-card .p-category:hover {
  color: var(--ink);
  background: var(--hover);
  border-color: var(--ink);
}

.pin-card .p-title {
  display: inline;
  max-width: 480px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
}

.pin-card .p-comments {
  display: inline;
  background: transparent;
  border: none;
  font-family: 'Noto Sans KR', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}

.pin-card .p-comments:hover {
  color: var(--ink);
  text-decoration: underline;
}

.pin-card .p-excerpt {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 10px;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pin-card .p-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'Noto Sans KR', monospace;
  font-size: 11px;
  color: var(--muted);
  border-top: none;
  padding-top: 0;
}

.badge-admin {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

/* new-post row */
.pin-card.compose {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 18px 4px;
  text-align: center;
}

.pin-card.compose::before {
  content: none;
}

.pin-card.compose .plus {
  font-size: 14px;
  color: var(--ink);
  font-family: 'Noto Sans KR', monospace;
}

.pin-card.pinned {
  background: var(--hover);
  border-left: 2px solid var(--border-strong);
}

.pin-card.pinned::before {
  content: '';
}

.pin-flag {
  position: absolute;
  top: 50%;
  left: 8px;
  transform: translate(0, -50%);
  width: 36px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: 'Noto Sans KR', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
}

.pin-toggle-btn {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 11px;
  padding: 4px 10px;
}

/* ---------- Single post ---------- */
.post-card {
  max-width: 640px;
  margin: 0 auto;
  border: none;
  padding: 0;
  position: relative;
  box-shadow: none;
  transform: none;
}

.post-card::before {
  content: none;
}

.post-card .p-category {
  display: inline-flex;
  font-family: 'Noto Sans KR', monospace;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  color: var(--ink);
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.post-card .p-title {
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 28px;
  margin: 0 0 10px;
  color: var(--ink);
  word-wrap: break-word;
}

.post-card .p-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 4px;
  gap: 4px;
  font-family: 'Noto Sans KR', monospace;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 28px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.p-meta .meta-item {
  white-space: nowrap;
}

.p-meta .meta-sep {
  color: var(--border-strong);
}

.post-card .p-body {
  min-height: 240px;
  font-size: 15px;
  line-height: 1.85;
  white-space: pre-wrap;
  margin-bottom: 32px;
  color: var(--ink);
}

.post-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 24px;
}

/* ---------- Forms ---------- */
.form-card {
  max-width: 520px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 32px 30px;
  box-shadow: none;
  transform: none;
}

.form-card h2 {
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 700;
  font-size: 20px;
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--ink);
}

.form-card p {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 13px;
  margin-top: 0;
  margin-bottom: 32px;
  color: var(--ink);
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-family: 'Noto Sans KR', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.field input[type="text"],
.field input[type="password"],
.field textarea {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.field input[type="text"]:focus,
.field input[type="password"]:focus,
.field textarea:focus {
  border-color: var(--border-strong);
}

.field textarea {
  min-height: 200px;
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 24px;
}

.error-note {
  background: var(--hover);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 20px;
  font-family: 'Noto Sans KR', monospace;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 48px;
  font-family: 'Noto Sans KR', monospace;
  font-size: 12px;
}

.pagination li {
  display: block;
  min-width: 32px;
  min-height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.pagination a,
.pagination span {
  display: inline-block;
  width: 100%;
  height: 100%;
  padding: 8px;
  text-decoration: none;
  text-align: center;
  color: var(--ink);
}

.pagination a:hover {
  background: var(--hover);
}

.pagination .current {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

.empty-note {
  text-align: center;
  color: var(--muted);
  font-family: 'Noto Sans KR', monospace;
  font-size: 13px;
  padding: 60px 0;
}

/* ---------- Comments ---------- */
.comments {
  max-width: 640px;
  margin: 36px auto 0;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.comments h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: var(--ink);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.comment {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.comment .c-meta {
  font-family: 'Noto Sans KR', monospace;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.c-reply-btn {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  font-family: 'Noto Sans KR', monospace;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  margin-left: auto;
  cursor: pointer;
}

.c-reply-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.comment .c-delete {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  font-family: 'Noto Sans KR', monospace;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}

.comment .c-delete:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.comment-reply {
  border-left: 2px solid var(--border);
  padding-left: 14px;
  margin-top: 12px;
}

/* .comment-reply::before {
  content: '└';
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translate(0, -50%);
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-family: 'Noto Sans KR', monospace;
  font-size: 12px;
  color: var(--muted);
} */

.comment .c-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
}

.c-reply-form {
  margin-top: 10px;
  padding: 12px;
  background: var(--hover);
  border: 1px solid var(--border);
}

.c-deleted {
  color: var(--muted);
  font-style: italic;
}

.c-deleted-admin-tag {
  color: #b91c1c;
  font-weight: 500;
}

.comment-form {
  margin-top: 24px;
  padding-top: 20px;
}

.comment-form .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.comment-form input[type="text"],
.comment-form input[type="password"] {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  flex: 1;
}

.comment-form textarea {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  min-height: 80px;
  resize: vertical;
  margin-bottom: 8px;
}

.comment-form input:focus,
.comment-form textarea:focus {
  border-color: var(--border-strong);
}

.comment-form .form-actions {
  margin-top: 0;
}

.comment-admin-note {
  font-family: 'Noto Sans KR', monospace;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}

@media (max-width: 640px) {
  .board-wrap {
    padding: 24px 16px;
  }

  .board-header {
    margin-bottom: 32px;
  }

  .tape-title a {
    font-size: 20px;
  }

  /* 게시글 카드: 좌우 패딩 줄이고 번호 겹침 방지 */
  .pin-card {
    padding: 14px 16px 14px 40px;
  }

  .pin-card::before {
    width: 24px;
    left: 8px;
    font-size: 11px;
  }

  .pin-card .p-title {
    max-width: 320px;
    font-size: 15px;
  }

  .pin-card .p-excerpt {
    font-size: 12px;
  }

  .pin-flag {
    width: 24px;
    left: 6px;
  }

  /* 게시글 본문 */
  .post-card .p-title {
    font-size: 22px;
  }

  .post-card .p-meta {
    font-size: 11px;
  }

  .post-card .p-body {
    font-size: 14px;
    line-height: 1.75;
  }

  .post-actions {
    flex-wrap: wrap;
  }

  /* 폼 카드 */
  .form-card {
    padding: 24px 18px;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions .btn {
    width: 100%;
    text-align: center;
  }

  /* 답글 들여쓰기 폭 축소 (화면 좁으니 과하게 밀리지 않게) */
  .comment-reply {
    padding-left: 10px;
  }

  /* 페이지네이션: 줄바꿈 허용 + 버튼 크기 축소 */
  .pagination {
    flex-wrap: wrap;
    gap: 4px;
  }

  .pagination li {
    min-width: 28px;
    min-height: 28px;
  }

  .pagination a,
  .pagination span {
    padding: 6px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .pin-card {
    padding: 12px 12px 12px 34px;
  }

  .pin-card .p-title {
    max-width: 240px;
  }

  .post-card .p-title {
    font-size: 19px;
  }

  .comment .c-meta {
    flex-wrap: wrap;
  }
}

@media (max-width: 420px) {
  .pin-card .p-title {
    max-width: 180px;
  }
}

@media (max-width: 320px) {
  .pin-card .p-title {
    max-width: 120px;
  }
}
