:root {
  --green-950: #163c32;
  --green-800: #245b49;
  --green-650: #387861;
  --green-100: #e9f2ed;
  --cream: #f6f5ef;
  --white: #ffffff;
  --ink: #1f2a26;
  --muted: #68736e;
  --line: #dce3df;
  --danger: #b44343;
  --shadow: 0 16px 45px rgba(22, 60, 50, .10);
}

* { box-sizing: border-box; }
html { font-family: Inter, Pretendard, "Noto Sans KR", system-ui, sans-serif; color: var(--ink); background: var(--cream); }
body { margin: 0; min-height: 100vh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
button[aria-busy="true"] { cursor: wait; }
.primary-button:focus-visible, .secondary-button:focus-visible, .danger-button:focus-visible,
.text-button:focus-visible, .back-button:focus-visible, .brand-button:focus-visible, .post-row:focus-visible {
  outline: 3px solid rgba(56,120,97,.3);
  outline-offset: 3px;
}
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(255,255,255,.14), transparent 34%),
    linear-gradient(145deg, #173f34 0%, #2e6b55 100%);
}
.login-card { width: min(440px, 100%); padding: 48px; border-radius: 24px; background: rgba(255,255,255,.97); box-shadow: 0 30px 80px rgba(0,0,0,.22); }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--green-950); color: white; font: 800 26px/1 Georgia, serif; }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 20px; flex: 0 0 auto; }
.eyebrow { margin: 22px 0 8px; color: var(--green-650); font-size: 12px; font-weight: 800; letter-spacing: .18em; }
.login-card h1 { margin: 0; color: var(--green-950); font-size: clamp(30px, 7vw, 40px); line-height: 1.2; letter-spacing: -.04em; }
.login-copy { margin: 18px 0 28px; color: var(--muted); }
.stack-form { display: grid; gap: 9px; }
label { font-size: 14px; font-weight: 700; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
input { height: 48px; padding: 0 14px; }
textarea { min-height: 160px; padding: 14px; resize: vertical; line-height: 1.7; }
input:focus, textarea:focus { border-color: var(--green-650); box-shadow: 0 0 0 3px rgba(56,120,97,.13); }
.form-error { min-height: 20px; margin: 2px 0; color: var(--danger); font-size: 13px; }

.primary-button, .secondary-button, .danger-button { border: 0; border-radius: 9px; padding: 11px 18px; font-weight: 750; }
.primary-button { background: var(--green-950); color: white; }
.primary-button:hover { background: var(--green-800); }
.primary-button.full { width: 100%; margin-top: 4px; }
.secondary-button { background: #edf0ee; color: var(--ink); }
.danger-button { background: #fff0f0; color: var(--danger); }
.text-button, .back-button { border: 0; padding: 6px; background: transparent; color: var(--green-800); font-weight: 700; }

.site-header { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.header-inner { width: min(1100px, calc(100% - 40px)); height: 76px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand-button { display: flex; align-items: center; gap: 12px; border: 0; padding: 0; text-align: left; background: transparent; color: var(--green-950); }
.brand-button strong, .brand-button small { display: block; }
.brand-button strong { font-size: 17px; }
.brand-button small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.account-area { display: flex; align-items: center; gap: 14px; font-size: 14px; }
#current-user { font-weight: 750; }
.main-content { width: min(1100px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 80px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading.compact { margin-bottom: 18px; }
.page-heading .eyebrow { margin-top: 0; }
.page-heading h2 { margin: 0; color: var(--green-950); font-size: 30px; letter-spacing: -.04em; }
.search-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; margin-bottom: 14px; }
.board-card, .editor-card, .detail-card, .comments-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: var(--shadow); }
.board-head, .post-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) 120px 120px 70px; align-items: center; }
.board-head { min-height: 48px; padding: 0 18px; border-bottom: 1px solid var(--line); background: #f3f6f4; color: var(--muted); font-size: 13px; font-weight: 750; text-align: center; }
.board-head span:nth-child(2) { text-align: left; }
.post-row { width: 100%; min-height: 64px; padding: 0 18px; border: 0; border-bottom: 1px solid #edf0ee; background: white; color: var(--ink); text-align: center; }
.post-row:last-child { border-bottom: 0; }
.post-row:hover { background: #f8faf9; }
.post-row .post-title { overflow: hidden; padding-right: 18px; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.comment-badge { margin-left: 6px; color: #18805f; font-size: 13px; font-weight: 800; }
.edited-label { display: block; margin-top: 2px; color: var(--green-650); font-size: 10px; font-weight: 750; }
.draft-status { min-height: 20px; margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.post-row .meta { color: var(--muted); font-size: 14px; }
.empty-state { padding: 60px 20px; color: var(--muted); text-align: center; }
.list-loading { padding: 34px 20px; color: var(--muted); text-align: center; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; color: var(--muted); font-size: 14px; }

.editor-card { display: grid; gap: 10px; padding: 28px; }
.editor-card textarea { min-height: 350px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.back-button { margin: -8px 0 14px; padding-left: 0; }
.detail-header { padding: 28px 30px 22px; border-bottom: 1px solid var(--line); }
.detail-header h2 { margin: 0 0 14px; font-size: 26px; line-height: 1.35; letter-spacing: -.025em; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 12px 24px; color: var(--muted); font-size: 14px; }
.detail-content { min-height: 220px; padding: 30px; white-space: pre-wrap; word-break: break-word; line-height: 1.8; }
.detail-content a, .comment-body a { color: #1c6ca1; text-decoration: underline; text-underline-offset: 3px; }
.owner-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); background: #fbfcfb; }
.comments-card { margin-top: 22px; padding: 26px 30px; }
.comments-card h3 { margin: 0 0 18px; font-size: 19px; }
.comments-card h3 span { color: var(--green-650); }
.comment-form { display: grid; grid-template-columns: 1fr auto; align-items: stretch; gap: 10px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.comment-form textarea { min-height: 86px; }
.comment-form button { min-width: 100px; }
.comment { padding: 20px 0; border-bottom: 1px solid #edf0ee; }
.comment.reply { margin-left: 44px; padding-left: 18px; border-left: 3px solid var(--green-100); }
.comment:last-child { border-bottom: 0; }
.comment-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.comment-author { font-weight: 750; }
.comment-date { margin-left: 8px; color: var(--muted); font-size: 12px; }
.comment-body { white-space: pre-wrap; word-break: break-word; line-height: 1.65; }
.comment-actions { display: flex; gap: 5px; margin-top: 8px; }
.comment-actions button { border: 0; padding: 3px 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.reply-form { display: flex; gap: 8px; margin-top: 12px; }
.reply-form textarea { min-height: 72px; }
.reply-form button { align-self: flex-end; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: min(360px, calc(100% - 44px)); padding: 13px 17px; border-radius: 10px; background: var(--green-950); color: white; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; box-shadow: var(--shadow); }
.toast.error { background: #9f3535; }
.toast.show { opacity: 1; transform: translateY(0); }
.password-dialog { width: min(480px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.password-dialog::backdrop { background: rgba(14, 34, 28, .58); backdrop-filter: blur(3px); }
.password-card { display: grid; gap: 9px; padding: 30px; }
.password-card .eyebrow { margin-top: 0; }
.password-card h2 { margin: 0; color: var(--green-950); }
.password-help { margin: 8px 0 14px; color: var(--muted); font-size: 13px; line-height: 1.55; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

@media (max-width: 720px) {
  .login-card { padding: 34px 26px; }
  .header-inner, .main-content { width: min(100% - 28px, 1100px); }
  .header-inner { height: 68px; }
  .brand-button small { display: none; }
  .main-content { padding-top: 34px; }
  .board-head { display: none; }
  .search-bar { grid-template-columns: minmax(0, 1fr) auto; }
  .search-bar #clear-search-button { grid-column: 1 / -1; justify-self: end; padding: 7px 12px; }
  .post-row { grid-template-columns: 1fr auto; gap: 7px 12px; padding: 16px; text-align: left; }
  .post-row > :first-child { display: none; }
  .post-row .post-title { grid-column: 1 / -1; padding: 0; }
  .post-row .meta.views { justify-self: end; }
  .post-row .meta.date::before { content: "· "; }
  .editor-card, .detail-header, .detail-content, .comments-card { padding-left: 20px; padding-right: 20px; }
  .comment-form { grid-template-columns: 1fr; }
  .comment-form button { justify-self: end; }
  .comment.reply { margin-left: 18px; }
  .account-area { gap: 6px; }
  .account-area .text-button { padding: 4px; font-size: 12px; }
  #current-user { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .password-card { padding: 24px 20px; }
}

/* Usability: compact mobile metadata, visible actions and explicit controls. */
button:focus-visible, a:focus-visible { outline: 3px solid #387861; outline-offset: 3px; }
.mobile-only { display: none; }
.remember-label { display: flex; gap: 9px; align-items: center; font-weight: 500; }
.remember-label input { width: 18px; height: 18px; }
.help-text, .editor-help { color: var(--muted); font-size: 13px; line-height: 1.6; }
.account-area { position: relative; }
#current-user { max-width: none; overflow: visible; }
.account-menu { position: absolute; right: 0; top: calc(100% + 12px); min-width: 180px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow); }
.account-menu p { margin: 4px 8px 8px; color: var(--muted); font-size: 12px; }
.account-menu button { display: block; width: 100%; min-height: 44px; text-align: left; padding: 10px; }
.search-bar { grid-template-columns: minmax(0, 1fr) auto; }
.search-field { position: relative; }
.search-icon { position: absolute; left: 13px; top: 10px; font-size: 24px; color: var(--muted); }
.search-field input { padding-left: 38px; padding-right: 46px; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-bar #clear-search-button { position: absolute; right: 3px; top: 3px; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 25px; }
.post-row .post-title { white-space: normal; line-height: 1.5; padding-top: 12px; padding-bottom: 12px; overflow-wrap: anywhere; }
.post-row .post-title > span:first-child { display: -webkit-inline-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; vertical-align: middle; max-width: 90%; }
.board-head, .post-row { grid-template-columns: 64px minmax(0, 1fr) 110px 140px 75px; }
.editor-card { overflow: visible; }
.editor-card textarea { min-height: 180px; height: clamp(180px, 30dvh, 350px); }
.editor-help { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.editor-help small, .character-count { font-size: 13px; }
.character-count { text-align: right; color: var(--muted); white-space: nowrap; }
.editor-actions { position: sticky; bottom: 12px; z-index: 5; padding: 12px; background: rgba(255,255,255,.98); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 5px 20px rgba(0,0,0,.08); }
.detail-content { min-height: 80px; }
.reply-form, .comment-edit-form { display: grid; gap: 8px; margin-top: 12px; }
.reply-form textarea, .comment-edit-form textarea { min-height: 100px; }
.comment-actions button { min-height: 40px; padding: 8px 12px; }
.comment-date { display: inline-block; line-height: 1.8; }
.loading-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(246,245,239,.85); color: var(--green-950); }
@media (max-width: 720px) {
  .post-row { grid-template-columns: auto 1fr auto; gap: 7px; }
  .post-row .post-title { grid-column: 1 / -1; }
  .post-row .meta { font-size: 12px; }
  .post-row .meta.date { justify-self: start; }
  .post-row .meta.views { justify-self: end; }
  .mobile-only { display: inline; }
  .edited-label { display: inline; margin-left: 4px; }
  .account-area .text-button { font-size: 14px; }
  .comment.reply { margin-left: 14px; }
  .comment-date { display: block; margin-left: 0; }
  .editor-actions { bottom: 8px; }
}
