/* ========== 天羽维基 Demo 样式 ========== */
:root {
  --bg: #111110;
  --bg-panel: #181816;
  --bg-raise: #1f1e1b;
  --border: #2c2a26;
  --text: #e9e3d6;
  --text-dim: #a39b8a;
  --gold: #c9a227;
  --gold-dim: #8a7220;
  /* 现代黑体栈：苹方/冬青/雅黑，回退黑体 */
  --font-hei: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", "SimHei", sans-serif;
  /* 正文宋体栈：思源宋/宋体-简，回退中易宋体 */
  --font-song: "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", "STSong", "SimSun", serif;
  --ease: cubic-bezier(.25,.6,.3,1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-song);
  font-size: 15px;
  line-height: 1.85;
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--text); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--gold); }

h1, h2, h3, h4 { font-family: var(--font-hei); font-weight: 600; color: var(--text); letter-spacing: .04em; }

/* ---------- 入场动效（克制） ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.panel, .notice-bar { animation: fadeUp .45s var(--ease) both; }
.layout-2col > aside .panel:nth-child(1) { animation-delay: .05s; }
.layout-2col > aside .panel:nth-child(2) { animation-delay: .12s; }
main .panel:nth-of-type(1) { animation-delay: .05s; }
main .panel:nth-of-type(2) { animation-delay: .12s; }
main .panel:nth-of-type(3) { animation-delay: .19s; }
main .panel:nth-of-type(4) { animation-delay: .26s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .panel, .notice-bar { animation: none; }
  * { transition: none !important; }
}

/* ---------- 顶部导航 ---------- */
.site-header {
  border-bottom: 2px solid var(--gold-dim);
  background: var(--bg-panel);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; height: 56px; gap: 16px;
}
.site-logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.site-logo img { height: 36px; display: block; }
.site-logo .logo-text {
  font-family: var(--font-hei); font-size: 20px; letter-spacing: 4px;
  color: var(--gold); white-space: nowrap;
}
.site-logo .logo-sub { font-size: 11px; color: var(--text-dim); letter-spacing: 2px; }

.site-nav { display: flex; gap: 2px; margin-left: auto; }
.site-nav a {
  padding: 6px 12px; font-family: var(--font-hei); font-size: 14px;
  color: var(--text-dim); border: 1px solid transparent; border-radius: 2px;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.site-nav a:hover { color: var(--gold); }
.site-nav a.active { color: var(--gold); border-color: var(--gold-dim); }

.nav-toggle {
  display: none; margin-left: auto; background: none;
  border: 1px solid var(--border); border-radius: 2px;
  color: var(--text); font-size: 18px; width: 38px; height: 34px; cursor: pointer;
}

.header-search { display: flex; flex-shrink: 0; }
.header-search input {
  background: var(--bg); border: 1px solid var(--border); border-right: none;
  color: var(--text); padding: 5px 10px; font-size: 13px; width: 160px;
  border-radius: 2px 0 0 2px; font-family: var(--font-song);
}
.header-search button {
  background: var(--gold-dim); color: #111; border: 1px solid var(--gold-dim);
  padding: 5px 12px; font-size: 13px; cursor: pointer; border-radius: 0 2px 2px 0;
  font-family: var(--font-hei);
}
.header-search button:hover { background: var(--gold); }

/* ---------- 主体布局 ---------- */
.page-wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }

.layout-2col { display: grid; grid-template-columns: 220px 1fr; gap: 20px; }
.layout-entry { display: grid; grid-template-columns: 1fr 230px; gap: 20px; }

/* ---------- 板块通用 ---------- */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-bottom: 20px;
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--gold);
}
.panel-head h2 { font-size: 16px; letter-spacing: 2px; }
.panel-head .more { font-size: 12px; color: var(--text-dim); }
.panel-body { padding: 12px 14px; }

/* ---------- 列表行（论坛风） ---------- */
.row-list { list-style: none; }
.row-list li {
  display: flex; align-items: baseline; gap: 10px;
  padding: 7px 6px; border-bottom: 1px dashed var(--border);
  font-size: 14px; margin: 0 -6px;
  transition: background .2s var(--ease);
}
.row-list li:hover { background: var(--bg-raise); }
.row-list li:last-child { border-bottom: none; }
.row-list .date { color: var(--text-dim); font-size: 12px; flex-shrink: 0; font-family: var(--font-hei); }
.row-list .tag-chip {
  font-size: 11px; color: var(--gold); border: 1px solid var(--gold-dim);
  padding: 0 6px; border-radius: 2px; flex-shrink: 0; font-family: var(--font-hei);
}
.row-list .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 公告 ---------- */
.notice-bar {
  border: 1px solid var(--gold-dim); background: var(--bg-raise);
  border-radius: 2px; padding: 10px 14px; margin-bottom: 20px;
  font-size: 14px;
}
.notice-bar strong { color: var(--gold); font-family: var(--font-hei); margin-right: 8px; }

/* ---------- 侧边目录 ---------- */
.side-toc {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 2px;
  position: sticky; top: 76px;
}
.side-toc .toc-head {
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  font-family: var(--font-hei); font-size: 13px; letter-spacing: 2px; color: var(--gold);
}
.side-toc ul { list-style: none; padding: 8px 0; }
.side-toc li a {
  display: block; padding: 5px 12px; font-size: 13px; color: var(--text-dim);
  border-left: 2px solid transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.side-toc li a:hover, .side-toc li a.current {
  color: var(--gold); border-left-color: var(--gold); background: var(--bg-raise);
}
.side-toc li.lv2 a { padding-left: 24px; }

/* 侧边导航菜单（分类列表） */
.side-menu { list-style: none; }
.side-menu li a {
  display: flex; justify-content: space-between;
  padding: 8px 12px; font-size: 14px; border-bottom: 1px dashed var(--border);
  transition: background .2s var(--ease), color .2s var(--ease), padding-left .2s var(--ease);
}
.side-menu li a:hover { background: var(--bg-raise); color: var(--gold); padding-left: 18px; }
.side-menu .count { color: var(--text-dim); font-size: 12px; }

/* ---------- 条目正文 ---------- */
.entry-header { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 16px; }
.entry-header h1 { font-size: 24px; letter-spacing: 1px; margin-bottom: 8px; }
.entry-meta { font-size: 12px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 14px; }
.entry-meta a { color: var(--gold); }

.entry-content { font-size: 15px; }
.entry-content h2 {
  font-size: 18px; margin: 24px 0 10px; padding-left: 10px;
  border-left: 3px solid var(--gold);
}
.entry-content h3 { font-size: 16px; margin: 18px 0 8px; }
.entry-content p { margin-bottom: 12px; }
.entry-content img {
  max-width: 100%; display: block; margin: 14px auto;
  border: 1px solid var(--border); border-radius: 2px;
}
.entry-content .img-cap { text-align: center; font-size: 12px; color: var(--text-dim); margin-top: -8px; margin-bottom: 14px; }

/* 信息表（条目右侧资料卡风格，方正） */
.info-table {
  width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13px;
  border: 1px solid var(--border);
}
.info-table th, .info-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.info-table th { background: var(--bg-raise); font-family: var(--font-hei); width: 90px; color: var(--gold); font-weight: normal; }

/* ---------- 标签 ---------- */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list a {
  font-size: 12px; border: 1px solid var(--border); padding: 2px 10px;
  border-radius: 2px; color: var(--text-dim); font-family: var(--font-hei);
  transition: border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.tag-list a:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-1px); }

/* ---------- 讨论区 ---------- */
.discuss-item { border: 1px solid var(--border); border-radius: 2px; margin-bottom: 12px; }
.discuss-head {
  padding: 6px 12px; background: var(--bg-raise); font-size: 12px;
  color: var(--text-dim); display: flex; justify-content: space-between;
  border-bottom: 1px solid var(--border); font-family: var(--font-hei);
}
.discuss-head .author { color: var(--gold); }
.discuss-body { padding: 10px 12px; font-size: 14px; }
.readonly-tip {
  font-size: 13px; color: var(--text-dim); border: 1px dashed var(--border);
  padding: 10px 12px; border-radius: 2px; text-align: center;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block; font-family: var(--font-hei); font-size: 13px;
  border: 1px solid var(--gold-dim); color: var(--gold); background: none;
  padding: 6px 16px; border-radius: 2px; cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.btn:hover { background: var(--gold); color: #111; border-color: var(--gold); }
.btn-solid { background: var(--gold-dim); color: #111; }
.btn-solid:hover { background: var(--gold); }

/* ---------- 登录页 ---------- */
.login-box {
  max-width: 360px; margin: 60px auto; background: var(--bg-panel);
  border: 1px solid var(--border); border-top: 3px solid var(--gold); border-radius: 2px;
  padding: 30px 28px;
}
.login-box h1 { font-size: 18px; letter-spacing: 4px; text-align: center; margin-bottom: 24px; color: var(--gold); }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13px; font-family: var(--font-hei); margin-bottom: 6px; color: var(--text-dim); }
.form-row input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 8px 10px; font-size: 14px; border-radius: 2px;
  font-family: var(--font-song);
}
.form-row input:focus { outline: none; border-color: var(--gold); }

/* ---------- 版本历史 ---------- */
.version-list { list-style: none; }
.version-list li {
  display: flex; align-items: center; gap: 12px; padding: 10px 4px;
  border-bottom: 1px dashed var(--border); font-size: 14px; flex-wrap: wrap;
}
.version-list .ver-no { font-family: var(--font-hei); color: var(--gold); flex-shrink: 0; }
.version-list .ver-time { color: var(--text-dim); font-size: 12px; }
.version-list .ver-actions { margin-left: auto; display: flex; gap: 8px; }
.version-list .btn { padding: 3px 10px; font-size: 12px; }

/* ---------- 搜索页 ---------- */
.search-hero { display: flex; gap: 0; margin-bottom: 24px; max-width: 560px; }
.search-hero input {
  flex: 1; background: var(--bg-panel); border: 1px solid var(--border); border-right: none;
  padding: 10px 14px; color: var(--text); font-size: 15px; border-radius: 2px 0 0 2px;
  font-family: var(--font-song);
}
.search-hero button { border-radius: 0 2px 2px 0; padding: 10px 22px; }
.search-result-item { padding: 12px 2px; border-bottom: 1px dashed var(--border); }
.search-result-item h3 { font-size: 16px; margin-bottom: 4px; }
.search-result-item h3 a:hover { color: var(--gold); }
.search-result-item p { font-size: 13px; color: var(--text-dim); }
.search-result-item mark { background: none; color: var(--gold); }
.result-stats { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 40px;
  padding: 20px 16px 30px; text-align: center;
  font-size: 12px; color: var(--text-dim);
}
.site-footer a { color: var(--text-dim); margin: 0 8px; }
.site-footer a:hover { color: var(--gold); }
.footer-links { margin-bottom: 8px; }

/* ---------- 后台入口按钮（可由后台开关控制显示） ---------- */
.admin-entry { position: fixed; right: 16px; bottom: 16px; z-index: 90; }
.admin-entry a {
  display: block; font-family: var(--font-hei); font-size: 12px;
  border: 1px solid var(--gold-dim); color: var(--gold);
  background: rgba(17,17,16,.9); padding: 6px 12px; border-radius: 2px;
}

/* ---------- 面包屑 ---------- */
.crumb { font-size: 12px; color: var(--text-dim); margin-bottom: 14px; font-family: var(--font-hei); }
.crumb a { color: var(--text-dim); }
.crumb a:hover { color: var(--gold); }

/* ---------- 后台 ---------- */
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px;
  display: grid; grid-template-columns: 200px 1fr; gap: 20px; }
.admin-side { background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 2px; align-self: start; position: sticky; top: 76px; }
.admin-side a { display: block; padding: 10px 14px; font-size: 14px;
  font-family: var(--font-hei); color: var(--text-dim);
  border-bottom: 1px dashed var(--border);
  transition: color .2s var(--ease), background .2s var(--ease); }
.admin-side a:last-child { border-bottom: none; }
.admin-side a:hover, .admin-side a.on { color: var(--gold); background: var(--bg-raise); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { border: 1px solid var(--border);
  padding: 8px 10px; text-align: left; }
.admin-table th { background: var(--bg-raise); font-family: var(--font-hei);
  color: var(--gold); font-weight: normal; white-space: nowrap; }
.admin-table .btn { padding: 2px 8px; font-size: 12px; }
.switch-row { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 14px; gap: 12px; flex-wrap: wrap; }
.state-pending { color: #c96b27; }
.state-pass { color: #6b9e4e; }
.state-reject { color: #9e4e4e; }
.admin-main code { background: var(--bg-raise); border: 1px solid var(--border);
  padding: 0 5px; border-radius: 2px; font-size: 12px; color: var(--gold); }

/* ---------- 移动端 ---------- */
@media (max-width: 860px) {
  .layout-2col, .layout-entry { grid-template-columns: 1fr; }
  .side-toc { position: static; }
  .header-search { display: none; }
  .nav-toggle { display: block; }
  .site-nav {
    display: flex; position: absolute; top: 56px; left: 0; right: 0;
    background: var(--bg-panel); border-bottom: 1px solid var(--border);
    flex-direction: column; padding: 0 16px; gap: 0;
    max-height: 0; opacity: 0; overflow: hidden; pointer-events: none;
    transition: max-height .3s var(--ease), opacity .25s var(--ease), padding .3s var(--ease);
  }
  .site-nav.open { max-height: 320px; opacity: 1; padding: 8px 16px; pointer-events: auto; }
  .site-nav a { padding: 10px 4px; border: none; border-bottom: 1px dashed var(--border); border-radius: 0; }
  .site-nav a:last-child { border-bottom: none; }
  .entry-header h1 { font-size: 20px; }
  .page-wrap { padding: 14px 12px 30px; }
  .admin-entry { right: 10px; bottom: 10px; }
  .admin-wrap { grid-template-columns: 1fr; }
  .admin-side { position: static; display: flex; flex-wrap: wrap; }
  .admin-side a { border: none; border-right: 1px dashed var(--border); padding: 8px 10px; }
  .table-scroll { overflow-x: auto; }
}
