@import url("https://fontsapi.zeoseven.com/521/main/result.css");

:root {
  --bg-primary: rgb(252, 252, 252);
  --bg-secondary: rgb(240, 240, 244);
  --text-primary: rgb(35, 35, 38);
  --text-muted: rgb(100, 100, 105);
  --text-url: rgb(140, 140, 148);
  --border: rgb(220, 220, 225);
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.25s ease;

  /* 搜索高亮 */
  --highlight-bg: rgba(255, 214, 0, 0.45);

  /* page_id 徽章 */
  --badge-bg: #3b82f6;
  --badge-text: #ffffff;

  /* 标签 */
  --tag-bg: rgb(230, 230, 236);
  --tag-text: rgb(55, 55, 62);

  /* 详情页 */
  --section-bg: rgb(246, 246, 249);
  --name-bg: rgb(230, 230, 236);
  
  --archived-shadow: rgb(255, 82, 82);   /* 红色：已归档页面 */
  --nonentry-shadow: rgb(96, 165, 250);  /* 浅蓝色：非词条页面 */
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

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

/* ========== 顶栏 ========== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 24px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none !important;
  color: var(--text-primary) !important;
  min-width: 0;
  flex-shrink: 1;
}

.topbar-left:hover,
.topbar-left:visited,
.topbar-left:active {
  opacity: 0.9;
  color: var(--text-primary) !important;
  text-decoration: none !important;
}

.logo {
  height: 36px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.site-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 搜索区域 */
.topbar-search {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  position: relative;
}

.search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-primary);
  transition: background var(--transition);
  flex-shrink: 0;
}

.search-toggle:hover {
  background: rgba(0, 0, 0, 0.06);
}

.search-toggle svg {
  width: 22px;
  height: 22px;
}

.search-form {
  display: flex;
  align-items: center;
  overflow: hidden;
  width: 0;
  transition: width 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.search-form.open {
  width: 240px;
}

.search-input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
  border-color: var(--badge-bg);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

/* ========== 主内容区 ========== */
.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ========== 首页统计 ========== */
.stats-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  width: 100%;
  max-width: 640px;
}

.stat-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.06);
}

.stat-label {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.stat-number-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 56px;
  overflow: hidden;
}

.digit-reel {
  display: inline-block;
  height: 56px;
  overflow: hidden;
  position: relative;
  margin: 0 1px;
}

.digit-strip {
  display: flex;
  flex-direction: column;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.digit-strip span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  font-size: 2.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--text-primary);
}

/* 三列统计 */
.stats-grid-3 {
  grid-template-columns: repeat(3, 1fr);
  max-width: 900px;
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.backup-info-wrapper {
  margin-top: 28px;
  text-align: center;
}

.backup-info-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* 备份中转圈 */
.backup-spinning {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.spin-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--text-muted);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 720px) {
  .stats-grid-3 {
    grid-template-columns: 1fr;
    max-width: 320px;
  }
}

/* ========== 搜索结果页 ========== */
.search-header {
  margin-bottom: 28px;
}

.search-header h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.search-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-item {
  display: block;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  transition: background var(--transition), box-shadow var(--transition);
}

.result-item:hover {
  background: rgb(234, 234, 240);
  box-shadow: var(--card-shadow);
}

.result-title {
  font-size: 1.5rem; /* 150% */
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 10px;
  word-break: break-word;
}

.result-title mark {
  background: var(--highlight-bg);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.result-name {
  font-size: 0.7rem; /* 70% */
  color: var(--text-url);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-badge {
  flex-shrink: 0;
  font-size: 0.5rem; /* 50% */
  font-weight: 600;
  background: var(--badge-bg);
  color: var(--badge-text);
  padding: 3px 8px;
  border-radius: 999px; /* 50% 圆角 → 胶囊 */
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 1rem;
}

/* 页面搜索筛选表单 */
.search-filter-form {
  margin: 18px 0 16px;
}
.search-filter-input {
  width: 100%;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  margin-bottom: 12px;
}
.search-filter-input:focus {
  border-color: var(--badge-bg);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.search-filter-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.9rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--badge-bg);
  cursor: pointer;
}
.search-filter-submit {
  height: 36px;
  padding: 0 20px;
  border: none;
  border-radius: 18px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
}
.search-filter-submit:hover {
  opacity: 0.85;
}
/* 已归档结果：红色投影 */
.result-item.is-archived {
  box-shadow: var(--archived-shadow) 0 0 1em;
}
.result-item.is-archived:hover {
  box-shadow: var(--archived-shadow) 0 0 1em;
}
/* 非词条结果：浅蓝色投影 */
.result-item.is-nonentry {
  box-shadow: var(--nonentry-shadow) 0 0 1em;
}
.result-item.is-nonentry:hover {
  box-shadow: var(--nonentry-shadow) 0 0 1em;
}
/* 加载更多按钮 */
.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}
.load-more-btn {
  display: inline-block;
  padding: 10px 32px;
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), opacity var(--transition);
}
.load-more-btn:hover {
  background: rgb(232, 232, 238);
  box-shadow: var(--card-shadow);
}
.load-more-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
/* 响应式（仅新增部分） */
@media (max-width: 560px) {
  .search-filter-options {
    gap: 8px 14px;
  }
  .search-filter-submit {
    padding: 0 16px;
  }
  .load-more-btn {
    padding: 9px 24px;
  }
}

/* ========== 页面详情页 ========== */
.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 14px;
  word-break: break-word;
}

.page-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.page-id-badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--badge-bg);
  color: var(--badge-text);
  padding: 4px 10px;
  border-radius: 999px;
}

.page-name-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-primary);
  background: var(--name-bg);
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  text-decoration: none !important;
  transition: background var(--transition), opacity var(--transition);
}

.page-name-link:hover {
  background: rgb(218, 218, 226);
  opacity: 1;
}

.page-name-link .link-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}

.page-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tag {
  display: inline-block;
  font-size: 0.8rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 500;
}

.section {
  margin-top: 36px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.file-card {
  background: var(--section-bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.9rem;
}

.file-name {
  font-weight: 600;
  margin-bottom: 6px;
  word-break: break-all;
}

.file-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.file-meta a {
  color: var(--badge-bg);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.revisions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.revision-item {
  background: var(--section-bg);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.9rem;
}

.revision-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 4px;
}

.rev-num {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rev-flag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--tag-bg);
  color: var(--tag-text);
}

.rev-time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.rev-author {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.rev-comment {
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 0.88rem;
}

.locked-badge {
  display: inline-block;
  font-size: 0.8rem;
  background: #fee2e2;
  color: #b91c1c;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 500;
}

/* 页面源代码 */
.source-code {
  display: block;
  width: 100%;
  min-height: 320px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--section-bg);
  color: var(--text-primary);
  font-family: "JetBrains Maple Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  overflow-x: auto;
}

.source-code:focus {
  border-color: var(--badge-bg);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* 修订历史标题行 + 分页 */
.section-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.per-page-form {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.per-page-form select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}

.page-btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.9rem;
  text-decoration: none !important;
  transition: background var(--transition);
}

.page-btn:hover {
  background: rgb(220, 220, 228);
}

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

/* 响应式 */
@media (max-width: 560px) {
  .stats-grid {
    grid-template-columns: 1fr;
    max-width: 320px;
  }

  .site-title {
    font-size: 0.95rem;
  }

  .logo {
    height: 30px;
  }

  .topbar {
    padding: 0 12px;
    height: 54px;
  }

  .search-form.open {
    width: 180px;
  }

  .digit-strip span {
    font-size: 2.25rem;
  }

  .stat-number-wrapper,
  .digit-reel,
  .digit-strip span {
    height: 48px;
  }

  .result-title {
    font-size: 1.2rem;
  }

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

.backup-info-wrapper{
    margin-top:16px;
    text-align:center;
}
.backup-info-text{
    color:var(--text-muted);
    font-size:14px;
}

.spinner-icon{
    display:inline‑block;
    width:14px;
    height:14px;
    border:2px solid var(--text-muted);
    border‑top‑color:transparent;
    border‑radius:50%;
    animation: spin 0.8s linear infinite;
    margin‑right:6px;
    vertical‑align:middle;
}
@keyframes spin{
    to{transform:rotate(360deg);}
}

/* 首页中部双列 */
.home-mid-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  width: 100%;
  max-width: 900px;
  margin-top: 8px;
}

.home-mid-left {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--card-shadow);
  min-width: 0;
}
.home-mid-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.mid-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--card-shadow);
}

.mid-card-edits .stat-number-wrapper {
  height: 48px;
}

.mid-card-edits .digit-reel,
.mid-card-edits .digit-strip span {
  height: 48px;
}

.mid-card-edits .digit-strip span {
  font-size: 2rem;
}

.members-chart-wrap {
  position: relative;
  width: 100%;
  height: 160px;
}

.members-chart-wrap canvas {
  width: 100%;
  height: 160px;
  display: block;
  cursor: crosshair;
}

.members-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: rgba(35, 35, 38, 0.9);
  color: #fff;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

@media (max-width: 800px) {
  .home-mid-grid {
    grid-template-columns: 1fr;
  }
}