:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-soft: #f1f1ed;
  --fg: #141414;
  --muted: #63635d;
  --soft: #9a9a91;
  --line: #deded6;
  --line-strong: #c8c8bc;
  --accent: #26364a;
  --accent-soft: #edf1f5;
  --danger: #a63838;
  --success: #276b42;
  --code: #f3f3ef;

  --page: 1080px;
  --home: 920px;
  --text: 720px;
  --toc: 230px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --serif: "Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

html.theme-dark {
  --bg: #111210;
  --surface: #171815;
  --surface-soft: #1e1f1b;
  --fg: #f0f0eb;
  --muted: #b2b2a8;
  --soft: #85857b;
  --line: #303129;
  --line-strong: #4a4b40;
  --accent: #d8dfeb;
  --accent-soft: #20242a;
  --code: #20211d;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 260px;
  background: linear-gradient(180deg, rgba(38,54,74,.075), rgba(38,54,74,0));
  pointer-events: none;
  z-index: -1;
}

::selection { background: var(--fg); color: var(--bg); }

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(99,99,93,.42);
  text-underline-offset: 4px;
}
a:hover { border-bottom-color: currentColor; }

.top,
main,
.site-footer {
  width: min(var(--page), calc(100vw - 56px));
  margin-left: auto;
  margin-right: auto;
}

.top {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.logo {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  color: var(--fg);
  border: 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: .12em;
}
.logo em { font-style: normal; color: var(--soft); font-weight: 650; }

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}
.nav a,
.theme-btn {
  color: var(--muted);
  border-bottom: 1px solid transparent;
}
.nav a:hover,
.theme-btn:hover { color: var(--fg); border-bottom-color: var(--fg); }
.lang-switch { font-family: var(--mono); letter-spacing: .06em; }
.theme-btn {
  width: auto;
  padding: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

main { padding-bottom: 86px; }

/* Home */
.home-hero {
  max-width: var(--home);
  margin: 0 auto;
  padding: 68px 0 42px;
}
.home-kicker,
.index-head span,
.admin-eyebrow,
.footer-label {
  color: var(--soft);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.home-hero h1 {
  margin: 14px 0 0;
  color: var(--fg);
  font-family: var(--serif);
  font-size: clamp(34px, 5.2vw, 52px);
  line-height: 1.08;
  letter-spacing: -.04em;
  font-weight: 560;
}
.home-hero p {
  max-width: 700px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 16.5px;
  line-height: 1.9;
}
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--soft);
  font-family: var(--mono);
  font-size: 12px;
}
.hero-stats b { color: var(--fg); font-weight: 760; }
.index-head {
  width: min(var(--home), 100%);
  margin: 0 auto 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}
.index-head h2 {
  margin: 6px 0 0;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -.025em;
}
.index-head a { color: var(--muted); font-size: 13px; }

.post-list {
  max-width: var(--home);
  margin: 0 auto;
  border-top: 1px solid var(--line-strong);
}
.post-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 34px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}
.post-row:hover h2 a { border-bottom-color: currentColor; }
.date {
  padding-top: 5px;
  color: var(--soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  text-transform: uppercase;
}
.post-row h2,
.post-content h2 {
  margin: 0;
  color: var(--fg);
  font-size: 20px;
  line-height: 1.38;
  letter-spacing: -.02em;
  font-weight: 680;
}
.post-row h2 a,
.post-content h2 a { border-bottom-color: transparent; }
.post-content p {
  max-width: 690px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.82;
}
.post-meta,
.tags {
  margin-top: 11px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  color: var(--soft);
  font-size: 13px;
}
.post-meta a,
.tags a { color: var(--muted); border-bottom-color: transparent; }
.post-meta a:hover,
.tags a:hover { color: var(--fg); border-bottom-color: var(--fg); }
.post-meta span { color: var(--muted); }

/* Generic pages */
.page-title {
  max-width: var(--home);
  margin: 0 auto;
  padding: 62px 0 28px;
  color: var(--fg);
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.22;
  letter-spacing: -.035em;
  font-weight: 560;
  text-align: center;
}
.page-title.compact {
  max-width: none;
  padding: 8px 0 22px;
  text-align: left;
}
.search-form {
  width: min(660px, 100%);
  margin: -4px auto 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
main > .small {
  width: min(660px, 100%);
  margin: 0 auto 22px;
  text-align: center;
  color: var(--soft);
  font-family: var(--mono);
  font-size: 12px;
}
.page-tag-cloud {
  width: min(720px, 100%);
  margin: -4px auto 56px;
  justify-content: center;
  gap: 10px;
  text-align: center;
}
.page-tag-cloud a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.42);
  color: var(--muted);
  font-size: 13px;
}
.page-tag-cloud a:hover {
  color: var(--fg);
  border-color: var(--line-strong);
  background: var(--surface);
}

/* Article */
.article-page { padding-top: 46px; }
.article-head {
  width: min(var(--text), 100%);
  margin: 0 auto 30px;
  padding-bottom: 25px;
  border-bottom: 1px solid var(--line-strong);
}
.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
}
.article-head h1 {
  margin: 0;
  color: var(--fg);
  font-family: var(--serif);
  font-size: clamp(27px, 3.6vw, 36px);
  line-height: 1.22;
  letter-spacing: -.035em;
  font-weight: 560;
}
.meta {
  color: var(--soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
}
.article-meta {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}
.article-meta span:not(:last-child)::after {
  content: "·";
  margin: 0 9px;
  color: var(--line-strong);
}
.article-tags { margin-top: 13px; }
.article-abstract {
  margin-top: 24px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 16px 42px rgba(25, 30, 35, .035);
}
.article-abstract h2 {
  margin: 0 0 8px;
  color: var(--soft);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.article-abstract p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.85;
}
.keyword-line { margin-top: 12px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.keyword-line b { color: var(--fg); }

.article-grid {
  width: min(var(--text), 100%);
  margin: 0 auto;
  position: relative;
}
.toc-side {
  position: fixed;
  top: 112px;
  left: calc(50vw + (var(--text) / 2) + 56px);
  width: var(--toc);
  color: var(--muted);
  z-index: 5;
}
.toc {
  margin: 0;
  padding-left: 15px;
  border-left: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.55;
}
.toc strong {
  display: block;
  margin-bottom: 9px;
  color: var(--soft);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.toc ol { margin: 0; padding-left: 0; list-style: none; }
.toc li { margin: 6px 0; }
.toc .toc-l3 { padding-left: 12px; }
.toc .toc-l4 { padding-left: 24px; }
.toc a {
  display: block;
  color: var(--muted);
  border-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toc a:hover,
.toc a.active { color: var(--fg); }
.toc a.active { font-weight: 700; }
.markdown { max-width: var(--text); color: var(--fg); }

/* Markdown */
.markdown-body {
  color: var(--fg);
  font-size: 16.5px;
  line-height: 1.92;
}
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: var(--fg);
  line-height: 1.32;
  letter-spacing: -.025em;
  scroll-margin-top: 96px;
}
.markdown-body h2 {
  margin-top: 44px;
  padding-top: 21px;
  border-top: 1px solid var(--line);
  font-size: 25px;
}
.markdown-body h3 { margin-top: 32px; font-size: 21px; }
.markdown-body h4 { margin-top: 26px; font-size: 18px; }
.heading-anchor {
  display: inline-block;
  width: 0;
  margin-left: -18px;
  padding-right: 18px;
  opacity: 0;
  border: 0;
  color: var(--soft);
}
.markdown-body h2:hover .heading-anchor,
.markdown-body h3:hover .heading-anchor,
.markdown-body h4:hover .heading-anchor { opacity: 1; }
.markdown-body p { margin-top: 0; margin-bottom: 18px; }
.markdown-body a { color: var(--accent); border-bottom: 1px solid rgba(38,54,74,.35); }
.markdown-body blockquote {
  margin: 22px 0;
  padding: 2px 0 2px 18px;
  color: var(--muted);
  border-left: 2px solid var(--line-strong);
}
.markdown-body code {
  font-family: var(--mono);
  font-size: .9em;
  background: var(--code);
  border: 1px solid var(--line);
  padding: .08em .32em;
  color: var(--fg);
}
.code-window {
  margin: 24px 0;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 16px 42px rgba(25, 30, 35, .035);
}
.code-title {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.code-title b { color: var(--soft); font-family: var(--mono); font-size: 12px; text-transform: uppercase; }
button.copy-code {
  margin-left: auto;
  width: auto;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--fg);
  padding: 4px 9px;
  font-size: 12px;
  line-height: 1.3;
  cursor: pointer;
}
.markdown-body pre { margin: 0; padding: 18px; overflow: auto; background: transparent; }
.markdown-body pre code {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.85;
}
.md-callout {
  margin: 22px 0;
  padding: 15px 17px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--muted);
}
.md-callout strong {
  display: block;
  margin-bottom: 4px;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .12em;
}
.md-callout p { margin: 0; }
.markdown-body ul,
.markdown-body ol { padding-left: 1.45em; }
.markdown-body li + li { margin-top: 7px; }
.markdown-body li.task { list-style: none; margin-left: -1.4em; }
.markdown-body input[type="checkbox"] { width: auto; margin-right: 8px; }
.markdown-body hr { border: 0; border-top: 1px solid var(--line); margin: 34px 0; }
.md-figure { margin: 28px 0; }
.md-figure img,
.upload-preview img,
.image-list img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--line);
  background: var(--surface);
}
.md-figure figcaption { margin-top: 8px; text-align: center; color: var(--soft); font-size: 13px; }
.md-table-wrap { margin: 22px 0; overflow: auto; border: 1px solid var(--line); background: var(--surface); }
.markdown-body table { width: 100%; min-width: 540px; border-collapse: collapse; font-size: 15px; }
.markdown-body th,
.markdown-body td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; }
.markdown-body th { background: var(--surface-soft); color: var(--fg); font-weight: 750; }
.markdown-body tr:last-child td { border-bottom: 0; }

/* About */
.about-page { width: min(var(--home), 100%); margin: 0 auto; padding-top: 62px; }
.about-hero { max-width: 760px; padding-bottom: 36px; }
.about-hero h1 {
  margin: 14px 0 0;
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.2;
  letter-spacing: -.035em;
  font-weight: 560;
}
.about-hero p { margin: 20px 0 0; color: var(--muted); font-size: 16px; line-height: 1.9; }
.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 16px 0 34px;
}
.about-card {
  min-height: 260px;
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 16px 42px rgba(25, 30, 35, .035);
}
.about-card span { color: var(--soft); font-family: var(--mono); font-size: 12px; }
.about-card h2 { margin: 36px 0 10px; font-size: 19px; line-height: 1.3; letter-spacing: -.02em; }
.about-card p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.85; }
.about-note { width: min(var(--text), 100%); margin: 0 auto; padding-top: 8px; }

/* Admin / Forms */
.admin-links {
  width: min(var(--home), 100%);
  display: flex;
  gap: 9px;
  margin: 34px auto 24px;
  flex-wrap: wrap;
}
.admin-links a,
.admin-actions a,
.admin-actions button {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 7px 11px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
}
.admin-links a:hover,
.admin-actions a:hover,
.admin-actions button:hover { color: var(--fg); border-color: var(--line-strong); }
.admin-panel { width: min(var(--home), 100%); margin: 0 auto; }
.admin-panel.narrow { width: min(var(--text), 100%); }
.editor-panel { width: min(var(--page), 100%); }
.form { display: grid; gap: 15px; }
.form label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-grid.three { grid-template-columns: 1.08fr .72fr 1.2fr; }
input,
textarea,
select,
button {
  width: 100%;
  font: inherit;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  padding: 11px 12px;
  border-radius: 3px;
  outline: none;
}
input:focus,
textarea:focus,
select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(38,54,74,.08); }
textarea { min-height: 420px; resize: vertical; font-family: var(--mono); font-size: 14px; line-height: 1.72; }
.form button,
.save-article-btn {
  cursor: pointer;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 750;
}
.notice,
.success,
.small,
.hint { max-width: var(--text); margin-left: auto; margin-right: auto; }
.notice { color: var(--danger); }
.success { color: var(--success); }
.small,
.hint { color: var(--muted); font-size: 13px; }
.snippet-box {
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 13px;
  padding: 11px 12px;
  background: var(--code);
  border: 1px solid var(--line);
  word-break: break-all;
  cursor: pointer;
}
.image-list { display: grid; gap: 28px; }
.image-item { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.upload-preview { margin-top: 16px; }
.admin-actions { display: flex; gap: 8px; margin-top: 13px; flex-wrap: wrap; }
.admin-actions form { margin: 0; }
.admin-actions button { width: auto; font: inherit; }
.admin-row { grid-template-columns: 92px minmax(0, 1fr); }

/* Editor */
.editor-workbench {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 8px;
}
.editor-media-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 17px;
  position: sticky;
  top: 92px;
  box-shadow: 0 16px 42px rgba(25, 30, 35, .035);
}
.editor-media-panel h2 { margin: 5px 0 14px; color: var(--fg); font-size: 18px; line-height: 1.25; letter-spacing: -.02em; }
.inline-upload { display: grid; gap: 10px; }
.inline-upload input[type="file"] { padding: 10px; font-size: 12px; }
.inline-upload button { cursor: pointer; border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 700; }
.inline-upload button:disabled { opacity: .55; cursor: wait; }
.recent-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.recent-image {
  display: block;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
}
.recent-image:hover { border-color: var(--accent); }
.recent-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.editor-main { min-width: 0; }
.editor-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 13px; }
.abstract-field { min-height: 112px; font-family: var(--sans); line-height: 1.75; }
.vditor-host {
  min-height: 680px;
  border-color: var(--line-strong) !important;
  background: var(--surface) !important;
  border-radius: 3px;
  overflow: hidden;
}
.vditor {
  --border-color: var(--line);
  --toolbar-background-color: var(--surface-soft);
  --textarea-background-color: var(--surface);
  --panel-background-color: var(--surface);
  --second-color: var(--muted);
}
.vditor-toolbar,
.vditor-ir,
.vditor-reset { font-family: var(--sans); }
.vditor-reset { font-size: 16px; line-height: 1.86; }
.save-article-btn { margin-top: 4px; }
.admin-posts .date { line-height: 1.8; }

/* Footer */
.site-footer {
  padding: 34px 0 48px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.footer-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 48px; }
.footer-name { margin-bottom: 6px; color: var(--muted); font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
.site-footer p { margin: 0 0 6px; color: var(--muted); }
.site-footer a { color: var(--muted); border-bottom-color: transparent; }
.site-footer a:hover { color: var(--fg); border-bottom-color: var(--fg); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--soft);
  font-size: 12px;
}
.footer-records { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--soft); }
.footer-records a { color: var(--soft); }
.footer-records em { font-style: normal; color: var(--soft); }
.read-progress { position: fixed; left: 0; top: 0; height: 2px; width: 0; background: var(--accent); z-index: 80; }

@media (max-width: 1240px) {
  .toc-side { position: static; width: auto; margin: 0 0 28px; }
  .toc { padding: 14px 0; border-left: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .toc ol { columns: 2; column-gap: 32px; }
  .toc a { white-space: normal; overflow: visible; text-overflow: clip; }
}
@media (max-width: 980px) {
  .editor-workbench { grid-template-columns: 1fr; }
  .editor-media-panel { position: static; }
  .recent-images { grid-template-columns: repeat(6, 1fr); }
  .about-grid { grid-template-columns: 1fr; }
  .about-card { min-height: auto; }
  .about-card h2 { margin-top: 18px; }
}
@media (max-width: 760px) {
  .top,
  main,
  .site-footer { width: calc(100vw - 32px); }
  .top { min-height: auto; padding: 20px 0 15px; align-items: flex-start; flex-direction: column; gap: 14px; }
  .nav { justify-content: flex-start; gap: 12px; }
  .home-hero { padding: 50px 0 38px; }
  .home-hero h1 { font-size: clamp(31px, 12vw, 44px); }
  .home-hero p { font-size: 15.5px; }
  .index-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .post-row,
  .admin-row { grid-template-columns: 1fr; gap: 6px; padding: 23px 0; }
  .article-page { padding-top: 34px; }
  .article-head h1 { font-size: 27px; }
  .toc ol { columns: 1; }
  .form-grid.two,
  .form-grid.three { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
  .footer-bottom { align-items: flex-start; flex-direction: column; }
  .footer-records { margin-left: 0; white-space: normal; }
  .recent-images { grid-template-columns: repeat(3, 1fr); }
  .article-abstract { padding: 15px; }
  .about-page { padding-top: 48px; }
}

/* v16.2 bilingual site layer */
.language-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--soft);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
}

.page-subtitle {
  max-width: var(--home);
  margin: -18px auto 34px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
}

.empty-state {
  max-width: var(--home);
  margin: 34px auto 0;
  padding: 34px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.empty-state h2 {
  margin: 0;
  font-size: 20px;
  font-family: var(--serif);
  font-weight: 560;
}
.empty-state p { color: var(--muted); margin: 10px 0 0; }

.translation-bar,
.translation-tools,
.translation-missing {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 82%, var(--surface-soft));
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}
.translation-bar {
  margin: 0 0 18px;
}
.translation-bar a,
.translation-missing a {
  color: var(--accent);
  font-weight: 650;
}
.translation-missing {
  margin: 0 0 18px;
  border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
}

.translation-tools {
  justify-content: space-between;
  margin: 0 0 18px;
}
.translation-tools div {
  display: grid;
  gap: 2px;
}
.translation-tools b {
  color: var(--fg);
}
.translation-tools span {
  color: var(--muted);
  font-size: 12px;
}
.translation-tools form { margin: 0; }
.translation-tools button,
.admin-actions button {
  min-height: 30px;
}

.form-grid.four {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.admin-actions form {
  display: inline-flex;
  margin: 0;
}

@media (max-width: 980px) {
  .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .form-grid.four { grid-template-columns: 1fr; }
  .translation-tools { align-items: flex-start; }
}


/* v16.3 cleaner bilingual UI */
.article-switch {
  margin: 0 0 18px;
  display: flex;
  justify-content: flex-end;
}
.article-switch a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}
.article-switch a:hover {
  color: var(--fg);
  border-color: var(--line-strong);
}

.about-minimal {
  width: min(720px, 100%);
  padding-top: 76px;
}
.about-minimal .about-hero {
  max-width: 720px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.about-minimal .about-hero h1 {
  font-size: clamp(30px, 5vw, 46px);
  letter-spacing: -.04em;
}
.about-profile {
  padding-top: 24px;
  display: grid;
  gap: 0;
}
.about-profile p {
  margin: 0;
  padding: 18px 0;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  color: var(--fg);
  font-size: 16px;
  line-height: 1.85;
}
.about-profile strong {
  font-weight: 560;
  color: var(--soft);
  white-space: nowrap;
}
.about-profile span {
  color: var(--fg);
}
.about-profile a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (max-width: 680px) {
  .about-profile p {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .article-switch {
    justify-content: flex-start;
  }
}


/* v16.4 refined simple pages */
.about-elegant {
  width: min(680px, 100%);
  padding-top: 88px;
}
.about-elegant .about-signature {
  text-align: center;
  padding-bottom: 30px;
}
.about-elegant .about-signature h1 {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.08;
  letter-spacing: -.045em;
  font-weight: 540;
}
.about-lines {
  margin: 0 auto;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}
.about-lines p {
  margin: 0;
  min-height: 64px;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  color: var(--fg);
}
.about-lines p:last-child { border-bottom: 0; }
.about-lines strong {
  color: var(--soft);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.about-lines span {
  color: var(--fg);
  font-size: 15.5px;
  line-height: 1.85;
}
.about-lines a {
  color: var(--fg);
  border-bottom-color: rgba(20,20,20,.36);
}
html.theme-dark .page-tag-cloud a { background: rgba(23,24,21,.48); }
html.theme-dark .about-lines a { border-bottom-color: rgba(240,240,235,.36); }

@media (max-width: 680px) {
  .search-form { grid-template-columns: 1fr; }
  .about-elegant { padding-top: 60px; }
  .about-lines p {
    grid-template-columns: 1fr;
    gap: 4px;
    align-items: start;
    padding: 16px 0;
  }
  .about-lines strong { text-transform: none; }
}

/* v16.5: cleaner language switch, grouped bilingual admin, dark editor fixes */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}
.lang-toggle a {
  min-width: 34px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  color: var(--soft);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  letter-spacing: .05em;
}
.lang-toggle a:hover { color: var(--fg); border: 0; }
.lang-toggle a.is-active {
  color: var(--fg);
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--line);
}

.version-intro {
  max-width: 720px;
  margin: -10px 0 24px;
  color: var(--muted);
  font-size: 14px;
}
.version-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.version-card {
  min-height: 190px;
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.version-card > span,
.version-badges span {
  color: var(--soft);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.version-card h2 {
  margin: 12px 0 8px;
  font-size: 19px;
  line-height: 1.35;
  letter-spacing: -.02em;
}
.version-card p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.version-card.is-missing {
  background: color-mix(in srgb, var(--surface) 62%, var(--surface-soft));
  border-style: dashed;
}
.version-card form { margin: 0; }
.version-card button { cursor: pointer; border-color: var(--accent); background: var(--accent); color: var(--bg); font-weight: 720; }
.version-actions { margin-top: auto; }
.version-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 18px;
  padding: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
}
.version-switcher a,
.version-switcher button {
  width: auto;
  min-height: 30px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.version-switcher a { display: inline-flex; align-items: center; border-bottom: 0; }
.version-switcher a.is-active {
  color: var(--fg);
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--line);
}
.version-switcher form { margin: 0; }
.version-switcher button:hover,
.version-switcher a:hover { color: var(--fg); }
.grouped-row h2 a { border-bottom-color: transparent; }
.grouped-row h2 a:hover { border-bottom-color: currentColor; }
.version-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.version-badges span {
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-transform: none;
}
.version-badges .is-ready { color: var(--success); border-color: color-mix(in srgb, var(--success) 26%, var(--line)); }
.version-badges .is-missing { color: var(--soft); border-style: dashed; }

.about-studio {
  width: min(760px, 100%);
  padding-top: 78px;
}
.about-studio-head {
  text-align: center;
  padding-bottom: 34px;
}
.about-studio-head h1 {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 48px);
  line-height: 1.08;
  letter-spacing: -.045em;
  font-weight: 540;
}
.about-studio-head p {
  max-width: 560px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.9;
}
.about-studio-card {
  padding: 6px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}
.about-studio-card dl { margin: 0; }
.about-studio-card div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 28px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.about-studio-card div:last-child { border-bottom: 0; }
.about-studio-card dt {
  color: var(--soft);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .08em;
}
.about-studio-card dd {
  margin: 0;
  color: var(--fg);
  font-size: 15.5px;
  line-height: 1.88;
}
.about-studio-card a { color: var(--fg); border-bottom-color: color-mix(in srgb, var(--fg) 38%, transparent); }

html.theme-dark input,
html.theme-dark textarea,
html.theme-dark select,
html.theme-dark button,
html.theme-dark .admin-links a,
html.theme-dark .admin-actions a,
html.theme-dark .admin-actions button,
html.theme-dark .snippet-box,
html.theme-dark .editor-media-panel,
html.theme-dark .version-card,
html.theme-dark .version-switcher {
  background: #171a1d;
  color: var(--fg);
  border-color: #34383c;
}
html.theme-dark input::placeholder,
html.theme-dark textarea::placeholder { color: #757d85; }
html.theme-dark input:focus,
html.theme-dark textarea:focus,
html.theme-dark select:focus {
  border-color: #8d99a8;
  box-shadow: 0 0 0 3px rgba(141,153,168,.16);
}
html.theme-dark .form button,
html.theme-dark .save-article-btn,
html.theme-dark .inline-upload button,
html.theme-dark .version-card button {
  background: #d8dfeb;
  border-color: #d8dfeb;
  color: #111210;
}
html.theme-dark .lang-toggle { background: #151719; border-color: #34383c; }
html.theme-dark .lang-toggle a.is-active,
html.theme-dark .version-switcher a.is-active {
  background: #252a30;
  box-shadow: inset 0 0 0 1px #3b4248;
}

html.theme-dark .vditor,
html.theme-dark .vditor-host {
  background: #14171a !important;
  color: #edf0f2 !important;
  border-color: #34383c !important;
}
html.theme-dark .vditor {
  --border-color: #34383c !important;
  --toolbar-background-color: #1b1f23 !important;
  --textarea-background-color: #14171a !important;
  --panel-background-color: #1b1f23 !important;
  --second-color: #aab2bb !important;
}
html.theme-dark .vditor-toolbar,
html.theme-dark .vditor-content,
html.theme-dark .vditor-ir,
html.theme-dark .vditor-sv,
html.theme-dark .vditor-wysiwyg,
html.theme-dark .vditor-preview,
html.theme-dark .vditor-reset {
  background: #14171a !important;
  color: #edf0f2 !important;
  border-color: #34383c !important;
}
html.theme-dark .vditor-toolbar {
  background: #1b1f23 !important;
}
html.theme-dark .vditor-toolbar button,
html.theme-dark .vditor-toolbar .vditor-tooltipped {
  color: #cfd7df !important;
}
html.theme-dark .vditor-toolbar button:hover,
html.theme-dark .vditor-toolbar button.vditor-menu--current {
  background: #252b31 !important;
}
html.theme-dark .vditor-toolbar svg {
  color: #cfd7df !important;
  fill: currentColor !important;
}
html.theme-dark .vditor-reset code,
html.theme-dark .vditor-reset pre,
html.theme-dark .vditor-ir pre,
html.theme-dark .vditor-sv pre {
  background: #1f2428 !important;
  color: #edf0f2 !important;
}
html.theme-dark .vditor-panel,
html.theme-dark .vditor-hint,
html.theme-dark .vditor-menu,
html.theme-dark .vditor-select,
html.theme-dark .vditor-emojis,
html.theme-dark .vditor-outline {
  background: #1b1f23 !important;
  color: #edf0f2 !important;
  border-color: #34383c !important;
}
html.theme-dark .vditor-hint button,
html.theme-dark .vditor-menu button {
  color: #edf0f2 !important;
}
html.theme-dark .vditor-hint button:hover,
html.theme-dark .vditor-menu button:hover {
  background: #252b31 !important;
}
html.theme-dark .vditor-ir__node--expand,
html.theme-dark .vditor-ir__marker {
  color: #aab2bb !important;
}
html.theme-dark .vditor-reset table tr,
html.theme-dark .vditor-reset table th,
html.theme-dark .vditor-reset table td {
  border-color: #34383c !important;
}

@media (max-width: 760px) {
  .version-cards { grid-template-columns: 1fr; }
  .about-studio { padding-top: 56px; }
  .about-studio-card div { grid-template-columns: 1fr; gap: 6px; padding: 17px 0; }
}
html.theme-dark .theme-btn {
  width: auto;
  padding: 0;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
html.theme-dark .theme-btn:hover { color: var(--fg); border-bottom-color: var(--fg); }

/* v16.6: fallback bilingual reading, refined about page, footer settings, stronger Vditor dark mode */
.translation-notice {
  margin: 0 0 24px;
  padding: 12px 14px;
  border-left: 3px solid var(--line-strong);
  background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.center-page-head {
  width: min(var(--text), 100%);
  margin: 0 auto 32px;
  padding-top: 58px;
  text-align: center;
}
.center-page-head .page-title { margin-left: auto; margin-right: auto; }
.center-small { text-align: center; }
.tags-page-head .page-title { margin-bottom: 26px; }
.page-tag-cloud {
  justify-content: center;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.about-journal {
  width: min(var(--text), 100%);
  padding-top: 70px;
}
.about-journal-head {
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line-strong);
}
.about-journal-head h1 {
  margin: 13px 0 0;
  font-family: var(--serif);
  font-size: clamp(32px, 4.8vw, 46px);
  line-height: 1.08;
  letter-spacing: -.045em;
  font-weight: 540;
}
.about-journal-head p {
  max-width: 680px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.9;
}
.about-journal-body {
  padding-top: 8px;
}
.about-journal-body section {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 32px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.about-journal-body h2 {
  margin: 2px 0 0;
  color: var(--soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.about-journal-body p {
  margin: 0;
  color: var(--fg);
  font-size: 15.5px;
  line-height: 1.95;
}
.about-contact-line a {
  color: var(--fg);
  border-bottom-color: color-mix(in srgb, var(--fg) 36%, transparent);
}
.form-help {
  margin-top: -8px;
  margin-bottom: 6px;
}
.form-help code {
  padding: 1px 5px;
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--mono);
}

/* Vditor dark fixes: toolbar buttons, SVG icons, textarea, menus, upload panels */
html.theme-dark input[type="file"]::file-selector-button {
  background: #252b31;
  color: #e8edf2;
  border: 1px solid #3c444c;
  border-radius: 5px;
  padding: 7px 10px;
  margin-right: 10px;
}
html.theme-dark input[type="file"]::file-selector-button:hover {
  background: #303841;
}
html.theme-dark .vditor-toolbar {
  background: #15191d !important;
  border-bottom: 1px solid #34383c !important;
}
html.theme-dark .vditor-toolbar__item,
html.theme-dark .vditor-toolbar__item > button,
html.theme-dark .vditor-toolbar button,
html.theme-dark .vditor-menu,
html.theme-dark .vditor-menu button {
  background: transparent !important;
  color: #d9e2ea !important;
  border: 0 !important;
  box-shadow: none !important;
}
html.theme-dark .vditor-toolbar__item > button,
html.theme-dark .vditor-toolbar button {
  border-radius: 6px !important;
}
html.theme-dark .vditor-toolbar__item > button:hover,
html.theme-dark .vditor-toolbar__item--current,
html.theme-dark .vditor-toolbar button:hover,
html.theme-dark .vditor-menu button:hover {
  background: #252c33 !important;
  color: #ffffff !important;
}
html.theme-dark .vditor-toolbar__item svg,
html.theme-dark .vditor-toolbar svg,
html.theme-dark .vditor-menu svg {
  color: #d9e2ea !important;
  fill: #d9e2ea !important;
  stroke: #d9e2ea !important;
  opacity: 1 !important;
}
html.theme-dark .vditor-toolbar__item svg path,
html.theme-dark .vditor-toolbar svg path,
html.theme-dark .vditor-menu svg path {
  fill: #d9e2ea !important;
  stroke: #d9e2ea !important;
}
html.theme-dark .vditor-toolbar__divider {
  border-left-color: #34383c !important;
}
html.theme-dark .vditor-ir textarea,
html.theme-dark .vditor-sv textarea,
html.theme-dark .vditor-textarea,
html.theme-dark .vditor-wysiwyg,
html.theme-dark .vditor-ir pre,
html.theme-dark .vditor-sv pre,
html.theme-dark .vditor-reset,
html.theme-dark .vditor-reset p,
html.theme-dark .vditor-reset li,
html.theme-dark .vditor-reset blockquote {
  background: #14171a !important;
  color: #edf0f2 !important;
  caret-color: #ffffff !important;
}
html.theme-dark .vditor-ir .vditor-ir__marker,
html.theme-dark .vditor-ir .vditor-ir__node,
html.theme-dark .vditor-sv .vditor-sv__marker,
html.theme-dark .vditor-placeholder {
  color: #89929c !important;
}
html.theme-dark .vditor-panel,
html.theme-dark .vditor-panel--none,
html.theme-dark .vditor-hint,
html.theme-dark .vditor-select,
html.theme-dark .vditor-emojis,
html.theme-dark .vditor-outline,
html.theme-dark .vditor-upload,
html.theme-dark .vditor-resize {
  background: #1b1f23 !important;
  color: #edf0f2 !important;
  border-color: #34383c !important;
}
html.theme-dark .vditor-panel input,
html.theme-dark .vditor-panel textarea,
html.theme-dark .vditor-select input {
  background: #121518 !important;
  color: #edf0f2 !important;
  border-color: #34383c !important;
}
html.theme-dark .vditor-counter {
  color: #89929c !important;
  background: transparent !important;
}

@media (max-width: 760px) {
  .about-journal { padding-top: 54px; }
  .about-journal-body section { grid-template-columns: 1fr; gap: 8px; padding: 22px 0; }
  .about-journal-body h2 { text-transform: none; }
}
