:root {
  color-scheme: light;
  --bg: #f7f3ea;
  --surface: #fffdf7;
  --surface-2: #efe9dc;
  --ink: #1d1d1b;
  --muted: #6e6a61;
  --line: #d8d1c3;
  --accent: #c6412d;
  --accent-ink: #fffaf2;
  --code-bg: #eee8db;
  --shadow: 0 18px 50px rgba(29, 29, 27, 0.08);
  --serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --sans: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171715;
  --surface: #20201d;
  --surface-2: #282824;
  --ink: #f2eee5;
  --muted: #b7b0a3;
  --line: #3a3934;
  --accent: #e76f51;
  --accent-ink: #171715;
  --code-bg: #191917;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.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;
}
.skip-link {
  position: fixed; left: 16px; top: -80px; z-index: 100;
  padding: 10px 16px; background: var(--ink); color: var(--bg);
}
.skip-link:focus { top: 16px; }
.container { width: min(1200px, calc(100% - 48px)); margin-inline: auto; }
.muted { color: var(--muted); }
.eyebrow {
  margin: 0 0 12px; color: var(--accent); font-family: var(--mono);
  font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
}
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border: 1px solid var(--line);
  border-radius: 4px; background: var(--surface); color: var(--ink);
  font-weight: 650; line-height: 1.2; transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.button:hover { border-color: var(--ink); color: var(--ink); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.primary:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.button.ghost { background: transparent; }
.button:disabled { opacity: 0.55; cursor: not-allowed; }

.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 78px; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-family: var(--serif); font-size: 19px; font-weight: 700; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  background: var(--ink); color: var(--bg); font-family: var(--mono); font-size: 18px;
}
.site-nav { display: flex; align-items: center; gap: 28px; font-size: 14px; font-weight: 600; }
.site-nav a { position: relative; padding-block: 8px; }
.site-nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 2px;
  height: 2px; background: var(--accent); transition: right 160ms ease;
}
.site-nav a:hover::after { right: 0; }
.theme-toggle, .menu-toggle {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--ink);
}
.menu-toggle { display: none; }

.hero {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(260px, 5fr);
  gap: 64px; align-items: end; padding-block: 92px 80px; border-bottom: 1px solid var(--line);
}
.hero h1 { max-width: 820px; margin: 0; font-family: var(--serif); font-size: clamp(44px, 6.4vw, 86px); line-height: 1.08; letter-spacing: -0.045em; }
.hero-description { max-width: 640px; margin: 28px 0 0; color: var(--muted); font-size: 18px; line-height: 1.85; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.hero-note { border-left: 2px solid var(--accent); padding: 8px 0 8px 24px; }
.hero-note .note-index { color: var(--accent); font-family: var(--mono); font-size: 12px; }
.hero-note p { margin: 18px 0 6px; font-family: var(--serif); font-size: 24px; }
.hero-note span:last-child { color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; }

.section { padding-block: 72px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.section-heading h2 { margin: 0; font-family: var(--serif); font-size: clamp(28px, 3vw, 40px); line-height: 1.2; }
.section-heading > a { color: var(--muted); font-size: 14px; font-weight: 600; }
.post-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.post-card { border: 1px solid var(--line); background: var(--surface); transition: border-color 160ms ease, transform 160ms ease; }
.post-card:hover { border-color: var(--ink); transform: translateY(-2px); }
.post-cover { display: block; overflow: hidden; border-bottom: 1px solid var(--line); aspect-ratio: 16 / 9; }
.post-cover img { width: 100%; height: 100%; object-fit: cover; }
.post-card-body { padding: 26px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; }
.post-card h2 { margin: 14px 0 12px; font-family: var(--serif); font-size: 25px; line-height: 1.4; }
.post-summary { margin: 0 0 20px; color: var(--muted); }
.post-card.featured { display: grid; grid-template-columns: minmax(0, 7fr) minmax(300px, 5fr); }
.post-card.featured .post-cover { border-bottom: 0; border-right: 1px solid var(--line); aspect-ratio: auto; min-height: 360px; }
.post-card.featured .post-card-body { display: flex; flex-direction: column; justify-content: center; padding: 44px; }
.post-card.featured h2 { font-size: clamp(30px, 3.6vw, 46px); }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 3px 8px; border: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 11px; }
.tag:hover { border-color: var(--accent); color: var(--accent); }
.tag-section { border-top: 1px solid var(--line); }
.tag-cloud { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.tag-cloud a { display: flex; justify-content: space-between; align-items: center; padding: 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tag-cloud a:hover { background: var(--surface); }
.tag-cloud small { color: var(--muted); font-family: var(--mono); }
.pagination { display: flex; justify-content: center; align-items: center; gap: 24px; margin-top: 44px; color: var(--muted); font-size: 14px; }
.pagination a { color: var(--ink); font-weight: 650; }
.pagination .disabled { opacity: 0.45; }
.empty-state { padding: 48px 0; color: var(--muted); text-align: center; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { display: flex; justify-content: space-between; gap: 48px; padding-block: 48px 32px; }
.footer-title { margin: 0 0 8px; font-family: var(--serif); font-size: 22px; font-weight: 700; }
.footer-inner .muted { max-width: 520px; margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; align-content: start; gap: 18px; font-size: 14px; }
.footer-bottom { display: flex; justify-content: space-between; gap: 24px; padding-block: 20px; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 11px; }

.page-section { padding-block: 72px 88px; }
.page-header { max-width: 780px; margin-bottom: 44px; }
.page-header h1 { margin: 0 0 16px; font-family: var(--serif); font-size: clamp(38px, 5vw, 64px); line-height: 1.15; letter-spacing: -0.035em; }
.page-header > p:last-child { color: var(--muted); }
.search-form { display: flex; gap: 12px; margin-top: 28px; }
.search-form input { flex: 1; min-width: 0; }
input, textarea, select {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 3px; background: var(--surface); color: var(--ink);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.65; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.75; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 650; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.form-status { min-height: 24px; margin: 12px 0 0; color: var(--accent); font-size: 13px; }

.article { padding-block: 72px 96px; }
.article-header { max-width: 920px; margin-inline: auto; text-align: center; }
.article-header h1 { margin: 0; font-family: var(--serif); font-size: clamp(38px, 5.4vw, 72px); line-height: 1.18; letter-spacing: -0.04em; }
.article-deck { max-width: 760px; margin: 24px auto 0; color: var(--muted); font-size: 18px; line-height: 1.85; }
.article-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin-top: 26px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.article-header .tag-list { justify-content: center; margin-top: 22px; }
.article-cover { max-width: 1040px; margin: 48px auto 0; border: 1px solid var(--line); }
.article-cover img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.article-layout { display: grid; grid-template-columns: minmax(0, 820px) minmax(180px, 1fr); gap: 72px; max-width: 1120px; margin: 64px auto 0; align-items: start; }
.article-content { min-width: 0; }
.article-toc { position: sticky; top: 28px; border-left: 1px solid var(--line); padding-left: 20px; }
.toc-title { margin: 0 0 14px; color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; }
.article-toc nav { display: grid; gap: 9px; }
.article-toc a { color: var(--muted); font-size: 12px; line-height: 1.5; }
.article-toc a:hover { color: var(--accent); }
.article-toc .toc-level-3 { padding-left: 12px; }
.article-toc .toc-level-4 { padding-left: 24px; }
.article-end { margin-top: 48px; color: var(--accent); font-size: 12px; }

.markdown-body { color: var(--ink); font-size: 18px; line-height: 1.85; overflow-wrap: break-word; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
  margin: 1.8em 0 0.65em; font-family: var(--serif); line-height: 1.35; scroll-margin-top: 28px;
}
.markdown-body h1 { font-size: 2.15em; }
.markdown-body h2 { padding-bottom: 0.35em; border-bottom: 1px solid var(--line); font-size: 1.55em; }
.markdown-body h3 { font-size: 1.25em; }
.markdown-body h4 { font-size: 1.05em; }
.markdown-body p { margin: 1em 0; }
.markdown-body ul, .markdown-body ol { padding-left: 1.4em; }
.markdown-body li { margin: 0.35em 0; }
.markdown-body blockquote { margin: 1.5em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent); color: var(--muted); }
.markdown-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.markdown-body img { width: 100%; height: auto; margin: 1.5em 0; border: 1px solid var(--line); aspect-ratio: 16 / 9; object-fit: cover; }
.markdown-body code { padding: 0.15em 0.35em; background: var(--code-bg); font-family: var(--mono); font-size: 0.86em; }
.markdown-body pre { position: relative; margin: 1.5em 0; padding: 20px; overflow: auto; border: 1px solid var(--line); background: var(--code-bg); line-height: 1.65; }
.markdown-body pre code { padding: 0; background: transparent; font-size: 13px; }
.copy-code { position: absolute; top: 8px; right: 8px; min-height: 32px; padding: 4px 9px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-family: var(--mono); font-size: 11px; }
.markdown-body table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; margin: 1.5em 0; }
.markdown-body th, .markdown-body td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; }
.markdown-body th { background: var(--surface-2); }
.markdown-body hr { margin: 2em 0; border: 0; border-top: 1px solid var(--line); }
.hljs { color: var(--ink); }
.hljs-comment, .hljs-quote { color: var(--muted); }
.hljs-keyword, .hljs-selector-tag, .hljs-literal { color: var(--accent); }
.hljs-string, .hljs-attr, .hljs-template-tag { color: #2f7d68; }
.hljs-number, .hljs-symbol, .hljs-variable { color: #a5651b; }
html[data-theme="dark"] .hljs-string, html[data-theme="dark"] .hljs-attr { color: #7dc7ad; }
html[data-theme="dark"] .hljs-number, html[data-theme="dark"] .hljs-variable { color: #e0ad68; }

.comments-section { max-width: 820px; margin: 80px auto 0; padding-top: 48px; border-top: 1px solid var(--line); }
.comment-list { display: grid; gap: 16px; margin-bottom: 32px; }
.comment { padding: 20px; border: 1px solid var(--line); background: var(--surface); }
.comment header { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.comment time { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.comment p { margin: 0 0 8px; white-space: pre-wrap; }
.comment > a { color: var(--accent); font-size: 12px; }
.comment-form { display: grid; gap: 18px; margin-top: 28px; padding: 28px; border: 1px solid var(--line); background: var(--surface); }
.cf-turnstile { min-height: 65px; }
.about-page { max-width: 880px; }
.about-content { font-size: 19px; }
.simple-content { max-width: 760px; }
.simple-content h1 { font-family: var(--serif); font-size: clamp(38px, 5vw, 64px); }
.simple-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.simple-card { width: min(560px, 100%); padding: 44px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.simple-card h1 { margin: 0 0 12px; font-family: var(--serif); font-size: 40px; }
.simple-card p { color: var(--muted); }
.simple-card .button { margin-top: 16px; }

@media (max-width: 1023px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding-block: 72px 64px; }
  .hero-note { max-width: 520px; }
  .post-card.featured { grid-template-columns: 1fr; }
  .post-card.featured .post-cover { border-right: 0; border-bottom: 1px solid var(--line); min-height: 0; aspect-ratio: 16 / 9; }
  .post-card.featured .post-card-body { padding: 32px; }
  .article-layout { grid-template-columns: 1fr; gap: 40px; }
  .article-toc { position: static; border-left: 0; border-top: 1px solid var(--line); padding: 20px 0 0; }
  .tag-cloud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .container { width: min(100% - 32px, 1200px); }
  .header-inner { min-height: 68px; }
  .menu-toggle { display: grid; }
  .site-nav {
    position: absolute; left: 0; right: 0; top: 68px; z-index: 50;
    display: none; align-items: stretch; gap: 0; padding: 12px 16px 20px;
    border-bottom: 1px solid var(--line); background: var(--bg);
  }
  .site-nav.is-open { display: flex; flex-direction: column; }
  .site-nav a { padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .site-nav a::after { display: none; }
  .theme-toggle { margin-top: 12px; }
  .hero { padding-block: 56px 48px; }
  .hero h1 { font-size: clamp(38px, 11vw, 58px); }
  .hero-description { font-size: 16px; }
  .section { padding-block: 52px; }
  .post-grid { grid-template-columns: 1fr; }
  .post-card-body, .post-card.featured .post-card-body { padding: 22px; }
  .tag-cloud { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: 28px; padding-block: 36px 24px; }
  .footer-bottom { flex-direction: column; gap: 8px; }
  .page-section { padding-block: 52px 64px; }
  .article { padding-block: 52px 64px; }
  .article-header h1 { font-size: clamp(34px, 9vw, 52px); }
  .article-deck { font-size: 16px; }
  .article-cover { margin-top: 32px; }
  .article-layout { margin-top: 40px; }
  .markdown-body { font-size: 16px; }
  .markdown-body pre { padding: 16px; }
  .comments-section { margin-top: 56px; padding-top: 36px; }
  .comment-form { padding: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .search-form { flex-direction: column; }
  .pagination { gap: 14px; font-size: 12px; }
  .simple-card { padding: 28px; }
}

/* Admin */
.admin-body { min-height: 100vh; background: var(--bg); }
.admin-login { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: min(440px, 100%); padding: 40px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.login-mark { width: 46px; height: 46px; margin-bottom: 26px; font-size: 24px; }
.login-card h1 { margin: 0 0 10px; font-family: var(--serif); font-size: 34px; }
.login-card > .muted { margin: 0 0 24px; }
.login-form { display: grid; gap: 18px; margin-top: 24px; }
.login-back { display: inline-block; margin-top: 24px; color: var(--muted); font-size: 13px; }
.admin-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.admin-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 20px; border-right: 1px solid var(--line); background: var(--surface); }
.admin-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; font-family: var(--serif); font-size: 18px; font-weight: 700; }
.admin-nav { display: grid; gap: 6px; }
.admin-nav a { padding: 11px 12px; border: 1px solid transparent; color: var(--muted); font-size: 14px; font-weight: 650; }
.admin-nav a:hover { color: var(--ink); background: var(--surface-2); }
.admin-nav a.active { border-color: var(--line); background: var(--bg); color: var(--ink); }
.admin-sidebar-footer { display: grid; gap: 8px; margin-top: auto; padding: 20px 8px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.admin-workspace { min-width: 0; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 28px 36px; border-bottom: 1px solid var(--line); }
.admin-topbar .eyebrow { margin-bottom: 6px; }
.admin-topbar h1 { margin: 0; font-family: var(--serif); font-size: 30px; }
.admin-content { padding: 32px 36px 64px; }
.admin-stack { display: grid; gap: 24px; }
.admin-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card { display: grid; gap: 12px; padding: 22px; border: 1px solid var(--line); background: var(--surface); }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card strong { font-family: var(--serif); font-size: 38px; line-height: 1; }
.stat-card.accent { border-top: 3px solid var(--accent); }
.admin-panel { border: 1px solid var(--line); background: var(--surface); }
.admin-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.admin-panel-heading h2, .admin-panel-heading h3 { margin: 0; font-family: var(--serif); }
.admin-panel-heading .eyebrow { margin-bottom: 5px; }
.admin-list { display: grid; }
.admin-list button { display: flex; align-items: center; justify-content: space-between; gap: 20px; width: 100%; padding: 18px 24px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.admin-list button:last-child { border-bottom: 0; }
.admin-list button:hover { background: var(--bg); }
.admin-list button > span:first-child { display: grid; gap: 5px; min-width: 0; }
.admin-list strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-list small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.admin-toolbar h2 { margin: 0; font-family: var(--serif); font-size: 30px; }
.segmented { display: inline-flex; border: 1px solid var(--line); background: var(--surface); }
.segmented button { min-height: 42px; padding: 8px 16px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--ink); color: var(--bg); }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.admin-table th, .admin-table td { padding: 16px 20px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.admin-table th { color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table td strong, .admin-table td small { display: block; }
.admin-table td small { margin-top: 4px; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.table-actions { white-space: nowrap; }
.table-actions button { padding: 6px 8px; border: 0; background: transparent; color: var(--accent); font-size: 13px; }
.table-actions button.danger { color: var(--muted); }
.status-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 3px 8px; border: 1px solid var(--line); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.status-badge.published, .status-badge.approved { border-color: #2f7d68; color: #2f7d68; }
.status-badge.draft, .status-badge.pending { border-color: #a5651b; color: #a5651b; }
.status-badge.spam { border-color: var(--accent); color: var(--accent); }
.admin-comment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.admin-comment { display: flex; flex-direction: column; padding: 22px; border: 1px solid var(--line); background: var(--surface); }
.admin-comment header { display: flex; justify-content: space-between; gap: 16px; }
.admin-comment header strong, .admin-comment header small { display: block; }
.admin-comment header small { margin-top: 4px; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.admin-comment > p { flex: 1; margin: 18px 0; white-space: pre-wrap; }
.comment-private { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 12px; }
.admin-comment footer { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.button.danger { border-color: var(--accent); color: var(--accent); }
.admin-pagination { margin-top: 0; }
.settings-form { display: grid; gap: 22px; padding-bottom: 28px; }
.settings-form > label, .settings-form > .form-grid, .settings-form > .admin-panel-heading, .settings-form > .form-actions, .settings-form > .admin-error, .settings-form > .admin-success { margin-inline: 24px; }
.settings-links { display: grid; gap: 16px; margin-inline: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.settings-links .admin-panel-heading { padding-inline: 0; }
.checkbox-label { display: flex; align-items: center; gap: 10px; }
.checkbox-label input { width: auto; min-height: auto; }
.admin-loading, .admin-empty { padding: 56px 24px; color: var(--muted); text-align: center; }
.admin-error, .admin-success { padding: 14px 16px; border: 1px solid var(--line); font-size: 13px; }
.admin-error { border-color: var(--accent); color: var(--accent); }
.admin-success { border-color: #2f7d68; color: #2f7d68; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.editor-pane { display: grid; gap: 18px; padding: 24px; }
.markdown-editor { min-height: 520px; font-family: var(--mono); font-size: 13px; }
.preview-pane { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow: auto; }
.preview-heading { display: flex; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 11px; }
.preview-cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border: 1px solid var(--line); }
.admin-markdown { font-size: 16px; }

@media (max-width: 1100px) {
  .admin-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .admin-content, .admin-topbar { padding-inline: 24px; }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-grid { grid-template-columns: 1fr; }
  .preview-pane { position: static; max-height: none; }
}

@media (max-width: 767px) {
  .admin-shell { display: block; }
  .admin-sidebar { position: static; width: 100%; height: auto; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-brand { padding-bottom: 16px; }
  .admin-nav { display: flex; overflow-x: auto; }
  .admin-nav a { white-space: nowrap; }
  .admin-sidebar-footer { display: none; }
  .admin-topbar { padding: 20px 16px; }
  .admin-topbar h1 { font-size: 25px; }
  .admin-content { padding: 20px 16px 48px; }
  .admin-stats { gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-card strong { font-size: 30px; }
  .admin-toolbar { align-items: stretch; flex-direction: column; }
  .segmented { align-self: flex-start; max-width: 100%; overflow-x: auto; }
  .admin-comment-grid { grid-template-columns: 1fr; }
  .admin-panel-heading { padding: 18px; }
  .settings-form > label, .settings-form > .form-grid, .settings-form > .admin-panel-heading, .settings-form > .form-actions, .settings-form > .admin-error, .settings-form > .admin-success, .settings-links { margin-inline: 18px; }
  .editor-pane { padding: 18px; }
  .login-card { padding: 28px; }
}

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