/* v4 杂志风 — 大图 / 衬线 / 宽间距 */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #151517;
  --ink-l: #3a3a40;
  --ink-m: #6b6b76;
  --paper: #faf7f2;
  --paper-d: #f1ede5;
  --card: #ffffff;
  --accent: #b95c2b;
  --accent-h: #8f441f;
  --serif: 'Songti SC', 'STSong', 'SimSun', 'Noto Serif CJK SC', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 夜间模式 */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ece7de;
  --ink-l: #c8c2b8;
  --ink-m: #9b948a;
  --paper: #16140f;
  --paper-d: #2b261e;
  --card: #1e1b15;
  --accent: #d97a45;
  --accent-h: #e89160;
}

html, body { background: var(--paper); color: var(--ink); font-family: var(--sans); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }

/* Hero */
.hero {
  position: relative; z-index: 1;
  background-color: #2a1e15;
  background-image: var(--wall, none);
  background-position: center; background-size: cover; background-repeat: no-repeat;
  color: #fff; padding: 100px 0 90px; margin-bottom: 60px;
}
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(135deg, rgba(21,21,23,.82), rgba(42,30,21,.55)); }
.hero-inner { position: relative; z-index: 2; max-width: 900px; margin: 0 auto; padding: 0 32px; }
.hero-brand { font-family: var(--serif); letter-spacing: 6px; font-size: 12px; opacity: .7; margin-bottom: 22px; }
.hero-title {
  font-family: var(--serif); font-size: clamp(34px, 6vw, 64px);
  line-height: 1.15; font-weight: 700; margin-bottom: 36px;
  text-shadow: 0 4px 18px rgba(0,0,0,.3);
}
.hero-search { max-width: 640px; }
.hero-tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.hero-tab {
  padding: 5px 14px; font-size: 12px; letter-spacing: 1px; color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.3); border-radius: 2px; cursor: pointer;
  transition: all .2s; font-family: var(--serif);
}
.hero-tab:hover { border-color: #fff; color: #fff; }
.hero-tab.active { background: #fff; color: #151517; border-color: #fff; }

/* 搜索分类下拉 */
.hero-cat-wrap { position: relative; }
.hero-cat {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px; font-size: 12px; letter-spacing: 1px;
  color: #fff; background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.4); border-radius: 2px;
  cursor: pointer; font-family: var(--serif);
  transition: background .2s;
}
.hero-cat:hover { background: rgba(255,255,255,.26); }
.hero-cat .caret { font-size: 9px; line-height: 1; transition: transform .2s; }
.hero-cat-wrap.open .caret { transform: rotate(180deg); }
.hero-cat-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  min-width: 100%; max-height: 320px; overflow-y: auto;
  padding: 4px; background: var(--card); border-radius: 2px;
  box-shadow: 0 8px 28px rgba(21,21,23,.22);
}
.hero-cat-wrap.open .hero-cat-menu { display: block; }
.hero-cat-item {
  padding: 8px 14px; font-size: 13px; color: var(--ink-l);
  white-space: nowrap; cursor: pointer; border-radius: 2px;
}
.hero-cat-item:hover { background: var(--paper-d); color: var(--ink); }
.hero-cat-item.active { color: var(--accent); font-weight: 600; }

.hero-row { display: flex; position: relative; }
.hero-row input {
  flex: 1; padding: 16px 20px; font-size: 15px;
  background: rgba(255,255,255,.95); border: none; border-radius: 2px 0 0 2px;
  color: #151517; font-family: var(--sans);
}
.hero-row input:focus { background: #fff; }
.hero-row button {
  padding: 0 28px; background: var(--accent); color: #fff; border: none;
  font-weight: 700; font-size: 14px; letter-spacing: 2px; border-radius: 0 2px 2px 0;
  font-family: var(--serif);
}
.hero-row button:hover { background: var(--accent-h); }

/* 全局搜索：导航建议面板 */
.gs-panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  max-height: 360px; overflow-y: auto; padding: 4px;
  background: var(--card); border-radius: 2px;
  box-shadow: 0 12px 32px rgba(21,21,23,.28);
  text-align: left;
}
.gs-item {
  display: flex; align-items: baseline; gap: 10px;
  padding: 9px 12px; border-radius: 2px; cursor: pointer;
  font-size: 14px; color: var(--ink); font-family: var(--sans);
}
.gs-item.active { background: var(--paper-d); }
.gs-name {
  flex: 0 1 auto; min-width: 0; max-width: 56%;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.gs-name mark { background: none; color: var(--accent); font-weight: 700; }
.gs-cat {
  flex: none; padding: 1px 6px; border-radius: 2px;
  font-size: 11px; color: var(--ink-m);
  border: 1px solid var(--paper-d); background: var(--paper);
}
.gs-url {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: 12px; color: var(--ink-m); text-align: right;
}
.gs-empty { padding: 12px 14px; font-size: 13px; color: var(--ink-m); }

/* 公告 + 常用搜索：左右各半 */
.notice-band {
  display: flex; align-items: stretch; margin-bottom: 40px;
  border-top: 1px solid var(--paper-d); border-bottom: 1px dashed var(--paper-d);
}
.notice-half { flex: 1 1 0; min-width: 0; padding: 13px 0; color: var(--ink-m); }
.notice-announce { font-size: 13px; overflow: hidden; padding-right: 28px; }
.notice-announce.auto-scroll {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
}
.announce-track { display: flex; width: max-content; }
.notice-announce.auto-scroll .announce-track {
  animation: announce-marquee var(--dur, 24s) linear infinite;
}
.notice-announce.auto-scroll:hover .announce-track { animation-play-state: paused; }
@keyframes announce-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.announce-set { display: flex; flex: none; white-space: nowrap; }
.notice-tools {
  display: flex; align-items: center; gap: 12px; flex-wrap: nowrap;
  padding-left: 28px; border-left: 1px solid var(--paper-d); font-size: 12px;
}
.notice-ttl {
  flex: none; font-family: var(--serif); font-size: 12px; font-weight: 700;
  letter-spacing: 1px; color: var(--ink);
}
.notice-tools-list {
  display: flex; align-items: baseline; gap: 14px;
  flex: 1 1 auto; min-width: 0;
  overflow-x: auto; white-space: nowrap; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent 100%);
  mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent 100%);
}
.notice-tools-list::-webkit-scrollbar { display: none; }
.theme-btn {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  background: none; border: none; border-radius: 50%;
  color: var(--ink-m); cursor: pointer;
  transition: color .15s, background .15s;
}
.theme-btn:hover { color: var(--accent); background: var(--paper-d); }
.theme-btn .ico { width: 16px; height: 16px; }
.theme-btn .ico-sun { display: none; }
html[data-theme="dark"] .theme-btn .ico-sun { display: block; }
html[data-theme="dark"] .theme-btn .ico-moon { display: none; }
/* 自动模式：显示半填充圆 */
.theme-btn .ico-auto { display: none; }
html[data-theme-mode="auto"] .theme-btn .ico-sun { display: none; }
html[data-theme-mode="auto"] .theme-btn .ico-moon { display: none; }
html[data-theme-mode="auto"] .theme-btn .ico-auto { display: block; }
.notice-tools-list a { color: var(--ink-m); border-bottom: 1px dotted transparent; transition: color .15s; }
.notice-tools-list a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.announce-item { display: inline-block; margin-right: 26px; }
.announce-item strong { color: var(--ink); font-weight: 600; }

/* 独立导航 */
.indep-section { margin-bottom: 72px; }
.indep-header { display: flex; align-items: baseline; gap: 16px; margin-bottom: 24px; }
.indep-header .big { font-family: var(--serif); font-size: 36px; font-weight: 700; }
.indep-header .small { font-family: var(--serif); font-style: italic; color: var(--ink-m); font-size: 14px; }
.indep-tool-entry {
  margin-left: auto; padding: 7px 15px; border: 1px solid var(--accent);
  border-radius: 999px; color: var(--accent); background: transparent;
  font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: .06em;
  cursor: pointer; transition: background .18s, color .18s;
}
.indep-tool-entry:hover { color: #fff; background: var(--accent); }
/* 快捷导航：按内容自然宽度排布，能一行就一行，放不下才换行（字号不变） */
.indep-grid { display: flex; flex-wrap: wrap; gap: 28px; }
.indep-block { flex: 1 1 auto; }
.indep-block h4 {
  font-family: var(--serif); font-size: 18px; margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 2px solid var(--accent); color: var(--ink); white-space: nowrap;
}
.indep-block ul { list-style: none; }
.indep-block li { margin-bottom: 6px; }
.indep-block a {
  font-size: 14px; color: var(--ink-l); transition: color .15s;
  padding: 2px 0; border-bottom: 1px dotted transparent; white-space: nowrap;
}
.indep-block a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* 杂志卡片 */
.mag-wrap { margin-bottom: 72px; }
.mag-nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px;
  margin-bottom: 30px; padding: 12px 0;
  background: var(--paper); border-bottom: 1px solid var(--paper-d);
}
.mag-nav-ttl {
  flex: none; padding-right: 18px; margin-right: 2px;
  border-right: 1px solid var(--paper-d);
  font-family: var(--serif); font-size: 12px; letter-spacing: 2px;
  color: var(--ink-m);
}
.mag-nav-item {
  flex: none; position: relative; padding: 2px 0;
  background: none; border: none; cursor: pointer;
  font-family: var(--sans); font-size: 13px; line-height: 1.4;
  color: var(--ink-m); white-space: nowrap; transition: color .15s;
}
.mag-nav-item:hover { color: var(--ink); }
.mag-nav-item.active { color: var(--accent); font-weight: 600; }
.mag-nav-item.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--accent);
}
.magazine {
  display: grid; grid-template-columns: 1fr; gap: 48px;
}
.mz-article {
  scroll-margin-top: 20px;
  background: var(--card); padding: 40px 44px; border-radius: 2px;
  box-shadow: 0 2px 20px rgba(21,21,23,.04);
  border-top: 3px solid var(--accent);
}
.mz-article-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 26px; padding-bottom: 18px; border-bottom: 1px solid var(--paper-d);
}
.mz-article-head h2 {
  font-family: var(--serif); font-size: 28px; font-weight: 700;
  display: flex; align-items: center; gap: 14px;
}
.mz-article-head h2::before {
  content: ''; width: 28px; height: 3px; background: var(--accent); display: inline-block;
}
.mz-article-count { font-family: var(--serif); font-style: italic; color: var(--ink-m); font-size: 13px; }

.mz-links {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 20px;
}
.mz-link {
  padding: 10px 14px; background: var(--paper); border-radius: 2px;
  font-size: 14px; color: var(--ink-l);
  display: flex; align-items: center; gap: 8px;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.mz-link:hover { border-left-color: var(--accent); background: var(--paper-d); color: var(--ink); }

/* 侧栏 */
.side { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; align-items: start; margin-bottom: 60px; }
.mz-card { background: var(--card); padding: 26px 26px; border-radius: 2px; box-shadow: 0 2px 14px rgba(21,21,23,.04); }
.mz-ttl {
  font-family: var(--serif); font-size: 20px; line-height: 1.4;
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--paper-d);
  display: flex; align-items: center; gap: 10px;
  text-wrap: balance;
}
.mz-ttl.is-wrapped { justify-content: center; text-align: center; }
.mz-ttl::before { content: ''; width: 20px; height: 2px; background: var(--accent); }
.mz-card ul { list-style: none; }
.mz-card li { margin-bottom: 8px; }
.mz-card a { font-size: 14px; color: var(--ink-l); }
.mz-card a:hover { color: var(--accent); }

/* 帮助 / 版权：链接式文本按钮 */
.link-btn {
  padding: 0; background: none; border: none; text-align: left;
  font-family: var(--sans); font-size: 14px; color: var(--ink-l);
  cursor: pointer; transition: color .15s;
}
.link-btn:hover { color: var(--accent); }
.text-body {
  max-height: 60vh; overflow-y: auto;
  font-size: 14px; line-height: 1.9; color: var(--ink-l);
  white-space: pre-wrap;
}
#textModal .box { width: min(680px, 90vw); }

/* 页脚 */
.foot { border-top: 1px solid var(--paper-d); padding: 32px 0; text-align: center; color: var(--ink-m); font-size: 13px; }

/* 右下角快捷登录 */
.fab {
  position: fixed; right: 28px; bottom: 28px; z-index: 60;
  display: flex; align-items: center; gap: 7px;
  padding: 10px 18px 10px 14px;
  font-family: var(--sans); font-size: 13px; color: var(--ink);
  background: var(--card); border: 1px solid var(--paper-d); border-radius: 999px;
  box-shadow: 0 6px 24px rgba(21,21,23,.12);
  cursor: pointer; transition: color .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.fab:hover {
  color: var(--accent); border-color: var(--accent);
  transform: translateY(-1px); box-shadow: 0 8px 28px rgba(21,21,23,.16);
}
.fab svg { width: 16px; height: 16px; }
.fab-top {
  bottom: 78px;
  opacity: 0; pointer-events: none;
}
.fab-top.show { opacity: 1; pointer-events: auto; }
.fab-top svg { width: 15px; height: 15px; }

/* 弹窗 */
.modal { display: none; position: fixed; inset: 0; z-index: 999; }
.modal.show { display: flex; align-items: center; justify-content: center; }
.mask { position: absolute; inset: 0; background: rgba(21,21,23,.65); }
.box { position: relative; z-index: 1; background: var(--card); padding: 36px; border-radius: 2px; min-width: 340px; }
.close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; cursor: pointer;
  font-size: 16px; line-height: 1; color: var(--ink-m);
}
.box h3 { font-family: var(--serif); font-size: 22px; margin-bottom: 18px; }
#loginForm { display: flex; flex-direction: column; gap: 12px; }
#loginForm input { padding: 11px 14px; border: 1px solid var(--paper-d); background: var(--paper); font-size: 14px; }
#loginForm input:focus { border-color: var(--accent); }
#loginForm button {
  padding: 12px; background: var(--accent); color: #fff; border: none;
  font-family: var(--serif); font-size: 14px; letter-spacing: 3px;
}
#loginForm button:hover { background: var(--accent-h); }

/* 登录框：验证码 + 版位切换 */
.cap { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; color: var(--ink-m); }
.cap-lbl { flex: none; font-family: var(--serif); letter-spacing: 1px; }
.cap-code {
  min-width: 8ch; padding: 3px 6px; background: var(--paper-d);
  font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: 10px;
  letter-spacing: .5px; color: var(--ink-l); text-align: center; white-space: nowrap;
}
.cap-ops { display: flex; gap: 8px; margin-top: 12px; }
.cap-ops button {
  flex: 1 1 0; min-width: 0; padding: 7px 0;
  background: transparent; border: 1px solid var(--paper-d);
  color: var(--ink-m); font-family: var(--sans); font-size: 12px;
  cursor: pointer; transition: all .15s;
}
.cap-ops button:hover { border-color: var(--accent); color: var(--accent); }
/* 数据源切换 */
.src-pick button.on { border-color: var(--accent); color: var(--accent); }
.src-pick button:disabled { opacity: .35; cursor: not-allowed; }

@media (max-width: 960px) {
  .mz-article { padding: 32px 28px; }
}

@media (max-width: 720px) {
  .hero { padding: 60px 0 56px; }
  .notice-band { flex-direction: column; }
  .notice-announce { padding-right: 0; }
  .notice-tools {
    padding-left: 0; padding-top: 10px; margin-top: 10px;
    border-left: none; border-top: 1px dashed var(--paper-d);
  }
  .magazine { gap: 32px; }
  .mag-nav { gap: 8px 16px; margin-bottom: 24px; padding: 11px 0; }
  .mag-nav-ttl { display: none; }
  .mz-article { padding: 28px 22px; }
  .side { grid-template-columns: 1fr; gap: 24px; }
  .indep-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .indep-block h4, .indep-block a { white-space: normal; }
}
