:root {
  --bg: #ffffff;
  --surface: #f4f5f7;
  --surface-hover: #eceef1;
  --line: #e6e8eb;
  --text: #191f28;
  --text-sub: #4e5968;
  --text-muted: #8b95a1;
  --accent: #4f46e5;
  --accent-soft: #eeedfd;
  --on-accent: #ffffff;
  --danger: #dc2626;
  --success: #15803d;
  --warning: #b45309;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418;
    --surface: #1d2026;
    --surface-hover: #262a31;
    --line: #2c3038;
    --text: #f2f4f6;
    --text-sub: #b0b8c1;
    --text-muted: #7e8894;
    --accent: #8f89f5;
    --accent-soft: #272654;
    --on-accent: #14121f;
    --danger: #f87171;
    --success: #4ade80;
    --warning: #fbbf24;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 960px;
  min-height: 60px;
  margin: 0 auto;
  padding: 0 16px;
}

.logo { flex: none; font-size: 18px; font-weight: 700; }

.menu {
  display: flex;
  flex: 1;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.menu::-webkit-scrollbar { display: none; }

.menu a {
  flex: none;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text-sub);
  font-size: 15px;
  font-weight: 500;
  transition: background-color 0.15s, color 0.15s;
}

.menu a:hover { background: var(--surface); }
.menu a.is-active { color: var(--accent); font-weight: 600; }

.container {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 16px 72px;
}

.container-wide { max-width: 960px; }

.page-title { margin: 0 0 24px; font-size: 28px; font-weight: 700; line-height: 1.35; }

.post-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }

.post-card {
  display: block;
  padding: 24px;
  border-radius: 20px;
  background: var(--surface);
  transition: background-color 0.15s, transform 0.15s;
}

.post-card:hover { background: var(--surface-hover); }
.post-card:active { transform: scale(0.99); }

.post-category { color: var(--accent); font-size: 14px; font-weight: 600; }

.post-card h2 { margin: 8px 0; font-size: 20px; font-weight: 700; line-height: 1.45; }

.post-card p {
  display: -webkit-box;
  margin: 0 0 12px;
  overflow: hidden;
  color: var(--text-sub);
  font-size: 15px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

time { color: var(--text-muted); font-size: 14px; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
  color: var(--text-sub);
  font-size: 15px;
}

.pagination a { padding: 8px 14px; border-radius: 10px; background: var(--surface); font-weight: 600; }

.article-header { margin-bottom: 40px; }
.article-header h1 { margin: 12px 0; font-size: 32px; font-weight: 700; line-height: 1.35; }

.article-body { font-size: 17px; line-height: 1.85; color: var(--text); }
.article-body h2 { margin: 48px 0 16px; font-size: 24px; line-height: 1.4; }
.article-body h3 { margin: 36px 0 12px; font-size: 20px; line-height: 1.45; }
.article-body p { margin: 0 0 20px; }
.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.article-body ul, .article-body ol { margin: 0 0 20px; padding-left: 24px; }
.article-body li { margin-bottom: 6px; }
.article-body img { display: block; max-width: 100%; height: auto; margin: 24px auto; border-radius: 16px; }
.article-body blockquote { margin: 24px 0; padding: 16px 20px; border-radius: 14px; background: var(--surface); color: var(--text-sub); }
.article-body blockquote p { margin: 0; }
.article-body code { padding: 2px 6px; border-radius: 6px; background: var(--surface); font-size: 0.9em; }
.article-body pre { margin: 0 0 20px; padding: 18px; overflow-x: auto; border-radius: 14px; background: var(--surface); line-height: 1.6; }
.article-body pre code { padding: 0; background: none; }
.article-body table { display: block; width: 100%; margin: 0 0 20px; overflow-x: auto; border-collapse: collapse; font-size: 15px; }
.article-body th, .article-body td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }

.site-footer { padding: 24px 16px 40px; color: var(--text-muted); font-size: 14px; text-align: center; }
.site-footer p { margin: 0; }

.empty { padding: 48px 0; color: var(--text-muted); font-size: 16px; text-align: center; }
.error-page { text-align: center; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.button:hover { opacity: 0.9; }
.button:active { transform: scale(0.98); }
.button-full { width: 100%; }
.button-light { background: var(--accent-soft); color: var(--accent); }

.text-button { padding: 8px; border: 0; background: none; color: var(--text-sub); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.text-button:hover { color: var(--text); }
.text-danger, .text-danger:hover { color: var(--danger); }

.form { display: grid; gap: 18px; }
.form label { display: grid; gap: 8px; color: var(--text-sub); font-size: 14px; font-weight: 600; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

textarea { resize: vertical; line-height: 1.65; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }

.form-error { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-size: 14px; }
.notice { margin: 0 0 20px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 500; }
.hint { margin: -12px 0 24px; color: var(--text-sub); font-size: 15px; }

.login-page { align-items: center; justify-content: center; padding: 16px; background: var(--surface); }
.login-card { width: 100%; max-width: 400px; padding: 32px; border-radius: 24px; background: var(--bg); }
.login-card h1 { margin: 0 0 24px; font-size: 24px; }

.admin-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.chips { display: flex; gap: 8px; margin-bottom: 20px; overflow-x: auto; }
.chips a { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--surface); color: var(--text-sub); font-size: 14px; font-weight: 600; }
.chips a.is-active { background: var(--accent); color: var(--on-accent); }

.admin-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.admin-list a { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; padding: 16px 18px; border-radius: 16px; background: var(--surface); }
.admin-list a:hover { background: var(--surface-hover); }
.admin-list strong { font-size: 16px; font-weight: 600; }
.admin-list small { grid-column: 2; color: var(--text-muted); font-size: 13px; }

.status { font-size: 13px; font-weight: 600; }
.status-draft { color: var(--text-muted); }
.status-review { color: var(--warning); }
.status-published { color: var(--success); }

.danger-zone { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); }

.category-row { display: grid; grid-template-columns: 1.4fr 1.2fr 80px auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.category-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.category-item .category-row { margin-bottom: 8px; }
.check { display: inline-flex; gap: 6px; align-items: center; color: var(--text-sub); font-size: 14px; white-space: nowrap; }
.check input { width: 18px; min-height: 18px; }

@media (max-width: 640px) {
  .site-header-inner { gap: 12px; }
  .container { padding-top: 28px; }
  .page-title { font-size: 24px; }
  .post-card { padding: 20px; border-radius: 16px; }
  .article-header h1 { font-size: 26px; }
  .article-body { font-size: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .category-row { grid-template-columns: 1fr 1fr; }
  .category-item { grid-template-columns: 1fr; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
}
