/* ==========================================================================
   Ukusil · 站点样式表
   设计基调：白纸、灰阶、墨色；以留白和信息层级取代装饰。
   所有颜色集中在 :root 变量里，改主题只需改这一处。
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-alt: #f8f9fa;
  --surface: #ffffff;
  --surface-2: #f4f5f6;
  --ink: #16181b;
  --ink-soft: #3f444b;
  --muted: #6c727b;
  --line: #e5e7ea;
  --line-strong: #c7cbd1;
  --link: #1f2329;
  --link-strong: #000000;
  --primary: #16181b;
  --primary-hover: #33373d;
  --primary-ink: #ffffff;
  --accent: #4e555e;
  --accent-soft: #eef0f2;
  --ok: #2f6b4f;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --shadow: 0 24px 60px rgba(18, 19, 22, 0.08);
  --shadow-sm: 0 8px 22px rgba(18, 19, 22, 0.06);
  --radius: 14px;
  --radius-sm: 8px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, "Times New Roman", serif;
  --sans: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #101113;
  --bg-alt: #15171a;
  --surface: #191b1e;
  --surface-2: #212429;
  --ink: #f1f2f3;
  --ink-soft: #c9ccd1;
  --muted: #9298a1;
  --line: #2d3035;
  --line-strong: #4a4f57;
  --link: #f1f2f3;
  --link-strong: #ffffff;
  --primary: #f1f2f3;
  --primary-hover: #ffffff;
  --primary-ink: #101113;
  --accent: #aeb3ba;
  --accent-soft: #26292e;
  --ok: #7fbf9d;
  --danger: #e08b80;
  --danger-soft: #3a2523;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--link-strong);
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

mark {
  padding: 0 0.12em;
  border-radius: 2px;
  background: #f5edcf;
  color: inherit;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  background: var(--primary);
  color: var(--primary-ink);
  padding: 10px 16px;
  border-radius: 0 0 8px 8px;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
  color: var(--primary-ink);
}

/* --------------------------------- 顶栏 ---------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  height: 66px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: transparent;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-mark-sm {
  width: 28px;
  height: 28px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.brand-text small {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.topsearch {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 4px 3px 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.topsearch:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--link) 10%, transparent);
}

.topsearch input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 7px 0;
  outline: none;
}

.topsearch input::placeholder {
  color: var(--muted);
}

.topsearch button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.topsearch button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.user-chip:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.user-name {
  font-size: 13px;
  max-width: 9em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  color: var(--accent);
  font-family: var(--serif);
  flex-shrink: 0;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 15px;
}

.avatar-xs {
  width: 26px;
  height: 26px;
  font-size: 13px;
}

.avatar-xl {
  width: 112px;
  height: 112px;
  font-size: 44px;
}

.avatar-initial {
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.inline-form {
  display: inline;
  margin: 0;
}

.link-btn {
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 4px;
  text-decoration: none;
}

.link-btn:hover {
  color: var(--link-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn.danger {
  color: var(--danger);
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.menu-toggle {
  display: none;
}

.theme-icon {
  font-size: 17px;
}

/* --------------------------------- 按钮 ---------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

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

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

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--link);
}

.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--line);
  color: var(--link-strong);
}

.btn-danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-sm {
  padding: 7px 13px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
  padding: 12px 18px;
}

/* --------------------------------- 布局 ---------------------------------- */

.layout {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 24px 72px;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 48px;
  flex: 1;
  align-items: start;
}

.main {
  min-width: 0;
  outline: none;
}

.sidebar {
  position: sticky;
  top: 96px;
  align-self: start;
  font-size: 14px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.side-link {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 2px solid transparent;
}

.side-link:hover {
  background: var(--surface);
  color: var(--ink);
}

.side-link.is-active {
  color: var(--ink);
  background: var(--surface);
  border-left-color: var(--accent);
  font-weight: 600;
}

.side-block {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.side-title {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  padding-left: 10px;
}

.side-sections {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.side-section {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--ink-soft);
  text-decoration: none;
}

.side-section:hover,
.side-section.is-active {
  background: var(--surface);
  color: var(--ink);
}

.side-section-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-count {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot, currentColor);
  flex-shrink: 0;
  display: inline-block;
}

.dot-lg {
  width: 12px;
  height: 12px;
}

.side-admin {
  display: block;
  margin-top: 14px;
  padding: 7px 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}

.side-admin:hover {
  color: var(--ink);
}

.side-card {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
}

.side-card strong {
  font-family: var(--serif);
  font-size: 15px;
}

.side-card p {
  margin: 6px 0 10px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

.side-card-link {
  font-size: 12px;
  text-decoration: none;
  color: var(--accent);
}

.side-card-link:hover {
  text-decoration: underline;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(12, 14, 18, 0.45);
  backdrop-filter: blur(2px);
}

.nav-backdrop[hidden] {
  display: none;
}

/* --------------------------------- 通知 ---------------------------------- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  margin: 0 0 24px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ok);
  border-radius: 6px;
  background: color-mix(in srgb, var(--ok) 7%, var(--surface));
  color: var(--ink-soft);
  font-size: 14px;
}

.notice-error {
  border-left-color: var(--danger);
  background: var(--danger-soft);
  color: var(--ink);
}

.notice-warn {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.notice span {
  flex: 1;
}

.notice-close {
  border: 0;
  background: none;
  color: inherit;
  opacity: 0.6;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.notice-close:hover {
  opacity: 1;
}

/* --------------------------------- 首页 ---------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.75fr);
  gap: 42px;
  padding: 46px 46px 42px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 4%, var(--surface)), var(--surface) 44%),
    var(--surface);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "W";
  position: absolute;
  right: -18px;
  bottom: -78px;
  font-family: var(--serif);
  font-size: 300px;
  line-height: 1;
  color: color-mix(in srgb, var(--ink) 4%, transparent);
  pointer-events: none;
}

.hero-main {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.hero-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.6rem, 5vw, 4rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.hero-tagline {
  margin: 14px 0 0;
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--ink-soft);
}

.hero-intro {
  margin: 18px 0 0;
  max-width: 34em;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.9;
}

.hero-search {
  display: flex;
  gap: 8px;
  margin: 28px 0 0;
  max-width: 520px;
}

.hero-search input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.hero-search input:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--link) 10%, transparent);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.hero-aside {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding-left: 36px;
  border-left: 1px solid var(--line);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 24px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.hero-quote {
  margin: 0;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.9;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.home-block {
  margin-top: 56px;
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.block-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.block-more {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.block-more:hover {
  color: var(--link);
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.section-grid-large {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--section-color, var(--accent));
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  min-height: 150px;
}

.section-card:hover {
  color: var(--ink);
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
  border-color: var(--line-strong);
  border-top-color: var(--section-color, var(--accent));
}

.section-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-card-top .dot {
  background: var(--section-color, var(--accent));
  width: 9px;
  height: 9px;
}

.section-card h3 {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

.section-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  flex: 1;
}

.section-count {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.section-card-link {
  font-size: 12px;
  color: var(--accent);
  margin-top: 6px;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.recent-item {
  padding: 18px 4px 17px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 5px;
  transition: background 0.12s ease;
}

.recent-item:hover {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.recent-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.recent-title {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
}

.recent-title:hover {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.recent-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recent-meta,
.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--badge, var(--muted)) 38%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--badge, var(--muted)) 9%, transparent);
  color: var(--badge, var(--muted));
  font-size: 11px;
  line-height: 1.6;
  text-decoration: none;
  white-space: nowrap;
}

a.badge:hover {
  color: var(--badge, var(--muted));
  border-color: var(--badge, var(--muted));
}

.badge-muted {
  --badge: var(--muted);
}

.badge-strong {
  --badge: var(--accent);
}

.badge-current {
  --badge: var(--ok);
}

/* --------------------------------- 条目页 -------------------------------- */

.page {
  max-width: 900px;
}

.page-header {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 30px;
}

.page-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.page-views {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.page-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 4.2vw, 2.9rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.25;
  word-break: break-word;
}

.page-meta {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: baseline;
}

.page-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}

.page-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.page-footer-links {
  display: flex;
  gap: 16px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--muted);
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--link);
}

.siblings {
  margin-top: 48px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.siblings h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink-soft);
}

.siblings ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 14px;
}

/* -------------------------------- 正文排版 -------------------------------- */

.wiki-content {
  font-size: 1.0625rem;
  line-height: 1.9;
  color: var(--ink-soft);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.wiki-content > *:first-child {
  margin-top: 0;
}

.wiki-content p {
  margin: 1.05em 0;
}

.wiki-content h2,
.wiki-content h3,
.wiki-content h4,
.wiki-content h5 {
  font-family: var(--serif);
  color: var(--ink);
  line-height: 1.4;
  margin: 2.1em 0 0.7em;
  font-weight: 700;
  scroll-margin-top: 90px;
}

.wiki-content h2 {
  font-size: 1.6rem;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--line);
}

.wiki-content h3 {
  font-size: 1.28rem;
}

.wiki-content h4 {
  font-size: 1.08rem;
}

.wiki-content a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent);
}

.wiki-content a:hover {
  text-decoration-color: currentColor;
}

.wiki-content a.wikilink {
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--link) 45%, transparent);
}

.wiki-content a.wikilink:hover {
  border-bottom-color: var(--link);
  background: color-mix(in srgb, var(--link) 6%, transparent);
}

.wiki-content a.wikilink.missing {
  color: var(--danger);
  border-bottom: 1px dashed color-mix(in srgb, var(--danger) 50%, transparent);
}

.wiki-content strong,
.wiki-content b {
  color: var(--ink);
  font-weight: 700;
}

.wiki-content ul,
.wiki-content ol {
  margin: 1em 0;
  padding-left: 1.6em;
}

.wiki-content li {
  margin: 0.35em 0;
}

.wiki-content li::marker {
  color: var(--accent);
}

.wiki-content blockquote {
  margin: 1.4em 0;
  padding: 0.4em 0 0.4em 1.2em;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.05em;
}

.wiki-content blockquote p {
  margin: 0.4em 0;
}

.wiki-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.6em auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
}

.entry-body img {
  cursor: pointer;
}

.wiki-content figure {
  margin: 1.6em 0;
}

.wiki-content figure img {
  margin-bottom: 0.5em;
}

.wiki-content figcaption {
  text-align: center;
  color: var(--muted);
  font-size: 0.85em;
}

.wiki-content hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.4em 0;
}

.wiki-content code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

.wiki-content pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.6;
}

.wiki-content pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.86rem;
}

.wiki-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.94rem;
  display: block;
  overflow-x: auto;
}

.wiki-content th,
.wiki-content td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

.wiki-content th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--ink);
}

.wiki-content mark {
  background: color-mix(in srgb, #e9c46a 45%, transparent);
  color: inherit;
  padding: 0 2px;
  border-radius: 3px;
}

/* 目录 */
.toc {
  width: 100%;
  margin: 4px 0 28px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.6;
}

.toc-title {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.toc ol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 4px 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc li.toc-h3 {
  padding-left: 12px;
  font-size: 12px;
  color: var(--muted);
}

.toc a {
  color: var(--ink-soft);
  text-decoration: none;
}

.toc a:hover {
  color: var(--link);
  text-decoration: underline;
}

/* -------------------------------- 空状态 --------------------------------- */

.empty-state {
  padding: 46px 30px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}

.empty-state-inline {
  padding: 34px 24px;
}

.empty-eyebrow {
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--accent);
}

.empty-state h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 1.4rem;
}

.empty-state p {
  margin: 0 auto 18px;
  max-width: 34em;
  color: var(--muted);
  font-size: 14px;
}

/* -------------------------------- 列表页 --------------------------------- */

.list-page {
  max-width: 900px;
}

.list-head {
  margin-bottom: 26px;
}

.list-head h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 12px;
}

.list-sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.list-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.section-head h1 .dot {
  background: var(--section-color, var(--accent));
  width: 12px;
  height: 12px;
}

.filter-bar {
  display: flex;
  gap: 8px;
  margin: 0 0 26px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.filter-bar input,
.filter-bar select {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.filter-bar input {
  flex: 1;
  min-width: 0;
}

.filter-bar select {
  max-width: 180px;
}

.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.result-item {
  padding: 18px 2px;
  border-bottom: 1px solid var(--line);
}

.result-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.result-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.result-title:hover {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.result-snippet {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.75;
}

.result-snippet mark {
  background: color-mix(in srgb, #e9c46a 50%, transparent);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 28px;
  font-size: 13px;
}

.page-btn {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--link);
  text-decoration: none;
}

.page-btn:hover {
  border-color: var(--line-strong);
}

.page-btn.is-disabled {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.page-info {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------- 历史 ---------------------------------- */

.breadcrumb + .list-head {
  margin-top: 4px;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.history-item {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.history-item.is-current {
  background: color-mix(in srgb, var(--ok) 5%, transparent);
}

.history-when {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.history-what {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.history-editor {
  color: var(--ink);
  font-weight: 600;
}

.history-comment {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.history-size {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.revision-page .notice {
  margin-bottom: 24px;
}

/* --------------------------------- 登录 ---------------------------------- */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 430px) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
  max-width: 980px;
  margin: 20px auto;
  padding: 20px 0 40px;
}

.auth-card {
  padding: 38px 36px 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card-wide {
  max-width: 560px;
}

.auth-card h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 2rem;
}

.auth-sub {
  margin: 8px 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-alt {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.auth-aside {
  border-left: 1px solid var(--line);
  padding-left: 48px;
}

.auth-quote {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.45rem;
  line-height: 1.8;
  color: var(--ink-soft);
}

.auth-points {
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-points li::before {
  content: "—";
  color: var(--accent);
  margin-right: 8px;
}

/* --------------------------------- 表单 ---------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  resize: vertical;
  line-height: 1.7;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 12%, transparent);
}

.field-hint,
.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin: 0;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-check {
  justify-content: flex-end;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-soft);
  padding: 10px 0;
}

.check-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* -------------------------------- 账户设置 -------------------------------- */

.settings-page,
.admin-page,
.profile-page {
  max-width: 960px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.settings-card {
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.settings-card h2 {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: 1.15rem;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.avatar-card {
  grid-row: span 2;
  text-align: center;
}

.avatar-frame {
  display: flex;
  justify-content: center;
  margin: 6px 0 18px;
}

.avatar-frame .avatar {
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.avatar-upload {
  cursor: pointer;
}

.avatar-status {
  min-height: 18px;
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.avatar-status.is-error {
  color: var(--danger);
}

.card-rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}

.account-facts {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  font-size: 13px;
}

.account-facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.account-facts dt {
  color: var(--muted);
}

.account-facts dd {
  margin: 0;
  color: var(--ink);
}

.account-links {
  margin: 18px 0 0;
  font-size: 13px;
}

/* -------------------------------- 用户主页 -------------------------------- */

.profile-head {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 40px;
}

.profile-avatar .avatar {
  border: 1px solid var(--line-strong);
}

.profile-info h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 2rem;
  line-height: 1.2;
}

.profile-handle {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-bio {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.8;
  max-width: 46em;
}

.profile-info .btn {
  margin-top: 16px;
}

/* --------------------------------- 管理 ---------------------------------- */

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 30px;
}

.admin-stats div {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.admin-stats dt {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.admin-stats dd {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.admin-card {
  margin-top: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-card > h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 1.25rem;
}

.admin-card > .hint {
  margin-bottom: 18px;
}

.admin-sections {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.admin-section {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.admin-section-form {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.admin-section-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.admin-section-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.admin-section-delete {
  padding-top: 4px;
}

.field-color {
  max-width: 86px;
}

.field-color input[type="color"] {
  padding: 3px;
  height: 40px;
  cursor: pointer;
}

.field-order {
  max-width: 92px;
}

.admin-add-section {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-add-section h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1rem;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.admin-table th {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 500;
}

.table-user {
  display: flex;
  align-items: center;
  gap: 9px;
}

.table-user small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

/* --------------------------------- 编辑器 -------------------------------- */

.editor-page {
  max-width: 980px;
}

.editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  margin-bottom: 22px;
}

.editor-head h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.9rem;
}

.editor-hint {
  margin: 0;
  max-width: 33em;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  text-align: right;
}

.editor-hint code {
  font-family: var(--mono);
  background: var(--surface-2);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
}

.editor-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-title {
  flex: 1;
}

.field-title input {
  font-family: var(--serif);
  font-size: 1.15rem;
  padding: 12px 14px;
}

.field-section {
  width: 210px;
}

.editor-shell {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.editor-shell:focus-within {
  border-color: var(--link);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 10%, transparent);
}

.toolbar {
  position: sticky;
  top: 66px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.toolbar-select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

.tool {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.tool:hover {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.tool.is-active {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.swatch {
  width: 26px;
  min-width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  background: var(--sw);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  margin: 3px;
}

.swatch:hover {
  transform: scale(1.12);
  border-color: var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong);
}

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--line);
  margin: 0 4px;
}

.editor {
  min-height: 430px;
  padding: 28px 34px 40px;
  outline: none;
  background: var(--surface);
  font-size: 1.0625rem;
  line-height: 1.9;
  color: var(--ink-soft);
}

.editor:empty::before,
.editor[data-empty="true"]::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.editor img {
  cursor: default;
}

.editor-meta {
  display: flex;
  align-items: flex-end;
  gap: 20px;
}

.field-summary {
  flex: 1;
}

.char-count {
  padding-bottom: 11px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.save-hint {
  font-size: 12px;
  color: var(--muted);
}

.draft-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 13px;
  color: var(--muted);
}

/* --------------------------------- 弹窗 ---------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 16, 20, 0.55);
  backdrop-filter: blur(3px);
}

.modal-dialog {
  position: relative;
  width: min(880px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
}

.modal-body {
  padding: 26px 32px;
  overflow-y: auto;
}

.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  background: var(--surface-2);
}

/* --------------------------------- 页脚 ---------------------------------- */

.footer {
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
  margin-top: auto;
}

.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 24px 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 36px;
  font-size: 12px;
  color: var(--muted);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-brand strong {
  font-family: var(--serif);
  color: var(--ink);
  font-size: 14px;
  display: block;
}

.footer-brand p {
  margin: 0;
  font-size: 11px;
}

.footer-copy {
  margin: 0;
  margin-left: auto;
}

.footer-note {
  margin: 0;
  flex-basis: 100%;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* --------------------------------- 报错 ---------------------------------- */

.error-page {
  max-width: 620px;
  padding: 60px 0 40px;
}

.error-code {
  margin: 0;
  font-family: var(--serif);
  font-size: 5rem;
  line-height: 1;
  color: color-mix(in srgb, var(--accent) 35%, transparent);
  font-weight: 700;
}

.error-page h1 {
  margin: 10px 0 12px;
  font-family: var(--serif);
  font-size: 2rem;
}

.error-page p {
  margin: 0 0 24px;
  color: var(--muted);
}

.error-page .btn {
  margin-right: 8px;
}

/* --------------------------------- Toast --------------------------------- */

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toast-in 0.2s ease;
  max-width: 320px;
}

.toast.is-error {
  background: var(--danger);
  color: #fff;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* -------------------------------- Lightbox -------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(10, 12, 15, 0.88);
  display: grid;
  place-items: center;
  padding: 30px;
  cursor: zoom-out;
}

.lightbox img {
  max-width: 94vw;
  max-height: 88vh;
  border-radius: 6px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.lightbox[hidden] {
  display: none;
}

/* -------------------------------- 响应式 --------------------------------- */

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 32px;
  }

  .hero {
    grid-template-columns: minmax(0, 1.3fr) minmax(230px, 0.7fr);
    gap: 30px;
    padding: 38px;
  }

  .section-grid-large {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-grid {
    grid-template-columns: 280px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .topbar-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 16px;
    gap: 10px;
  }

  .menu-toggle {
    display: grid;
  }

  .brand-text small {
    display: none;
  }

  .topsearch {
    order: 5;
    flex-basis: 100%;
    max-width: none;
  }

  .top-actions {
    gap: 8px;
  }

  .user-name {
    display: none;
  }

  .new-btn {
    padding: 7px 10px;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 22px 18px 56px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 282px;
    z-index: 60;
    padding: 26px 20px 30px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    overflow-y: auto;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }

  body.nav-open .sidebar {
    transform: none;
  }

  body.nav-open {
    overflow: hidden;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 30px 24px;
  }

  .hero::after {
    font-size: 220px;
    bottom: -52px;
  }

  .hero-aside {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 24px;
  }

  .section-grid,
  .section-grid-large {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .avatar-card {
    grid-row: auto;
  }

  .auth {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .auth-aside {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 24px;
  }

  .toc {
    float: none;
    width: auto;
    margin: 0 0 24px;
  }

  .history-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .history-actions {
    justify-content: flex-start;
  }

  .editor-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .editor-hint {
    text-align: left;
  }

  .field-section {
    width: 100%;
  }

  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-section {
    flex-direction: column;
  }

  .admin-section-form {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .brand-text strong {
    font-size: 16px;
  }

  .hero {
    border-radius: 14px;
  }

  .hero-search {
    flex-direction: column;
  }

  .hero-search .btn {
    width: 100%;
  }

  .section-grid,
  .section-grid-large {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-bar {
    flex-wrap: wrap;
  }

  .filter-bar select {
    max-width: none;
    flex: 1;
  }

  .page-title {
    font-size: 1.85rem;
  }

  .page-footer {
    flex-direction: column;
  }

  .profile-head {
    flex-direction: column;
    padding: 22px;
  }

  .avatar-xl {
    width: 88px;
    height: 88px;
    font-size: 34px;
  }

  .editor {
    padding: 18px 16px 30px;
  }

  .editor-meta {
    flex-direction: column;
    align-items: stretch;
  }

  .char-count {
    padding-bottom: 0;
    text-align: right;
  }

  .toolbar {
    top: 56px;
  }

  .modal {
    padding: 10px;
  }

  .modal-body {
    padding: 18px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-copy {
    margin-left: 0;
  }

  .history-comment {
    white-space: normal;
  }

  .logout-form {
    display: none;
  }
}

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

@media print {
  .topbar,
  .sidebar,
  .footer,
  .page-tools,
  .toc,
  .toast-stack {
    display: none !important;
  }

  .layout {
    display: block;
    padding: 0;
  }

  body {
    background: #fff;
  }

  .page {
    max-width: none;
  }

  .wiki-content {
    font-size: 11pt;
  }
}
