:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1f2329;
  --ink-soft: #5b6470;
  --ink-faint: #9aa3af;
  --line: #e6e9ef;
  --accent: #2f6fed;
  --tag: #eef1f6;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(20, 30, 50, .06);
  --sidebar-w: 216px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--panel); border-right: 1px solid var(--line);
  height: 100vh; position: sticky; top: 0;
  display: flex; flex-direction: column; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; }
.brand-logo { font-size: 22px; }
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--ink-faint); }

.module-nav { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: 1; }
.module-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; border-radius: 10px; cursor: pointer;
  color: var(--ink-soft); font-size: 14px; border: 1px solid transparent;
  transition: background .15s, color .15s;
}
.module-item:hover { background: var(--bg); color: var(--ink); }
.module-item.active { background: color-mix(in srgb, var(--accent) 10%, #fff); color: var(--accent); font-weight: 600; border-color: color-mix(in srgb, var(--accent) 22%, #fff); }
.mi-mark { width: 20px; height: 20px; color: var(--accent); display: flex; align-items: center; justify-content: center; flex: 0 0 20px; }
.mi-mark svg { width: 100%; height: 100%; display: block; }
.fallback-mark { font-weight: 700; font-size: 13px; }
.mi-name { flex: 1; }
.mi-count { font-size: 11px; color: var(--ink-faint); background: var(--tag); border-radius: 999px; padding: 1px 7px; }
.sidebar-foot { font-size: 11px; color: var(--ink-faint); padding: 10px 8px 0; border-top: 1px solid var(--line); margin-top: 8px; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: rgba(245,246,248,.88); backdrop-filter: blur(6px);
  padding: 16px 30px; display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--line);
}
.search-box {
  flex: 1; max-width: 560px; display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 9px 15px; box-shadow: var(--shadow);
}
.search-box:focus-within { border-color: var(--accent); }
.search-icon { color: var(--ink-faint); }
#searchInput { flex: 1; border: none; outline: none; font-size: 14px; background: transparent; color: var(--ink); }
.clear-btn { border: none; background: var(--tag); color: var(--ink-soft); border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 14px; line-height: 1; }
.result-stat { font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
.content { padding: 26px 30px 48px; overflow-y: auto; flex: 1; }

/* ---------- Hero + 三大板块 ---------- */
.hero { margin-bottom: 22px; }
.hero h1 { font-size: 24px; margin: 0 0 5px; letter-spacing: 1px; }
.hero p { margin: 0; color: var(--ink-soft); font-size: 13px; }

.showcase { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }
.mcard {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 26px 22px 20px; cursor: pointer; text-align: center; box-shadow: var(--shadow);
  transition: transform .14s, box-shadow .14s, border-color .14s;
}
.mcard:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 35%, #fff); box-shadow: 0 10px 26px rgba(20,30,50,.11); }
.mcard-icon {
  width: 92px; height: 92px; margin: 0 auto 14px; border-radius: 24px;
  display: flex; align-items: center; justify-content: center; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, #fff);
}
.mcard-icon svg { width: 56px; height: 56px; display: block; }
.mcard-icon .fallback-mark { font-size: 32px; font-weight: 700; }
.mcard-name { font-size: 22px; font-weight: 700; letter-spacing: 3px; color: var(--accent); }
.mcard-pinyin { font-size: 11px; color: var(--ink-faint); letter-spacing: 1px; margin-top: 2px; }
.mcard-desc { font-size: 12.5px; color: var(--ink-soft); margin-top: 12px; letter-spacing: .5px; }
.mcard-cats { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 16px; padding-top: 15px; border-top: 1px dashed var(--line); }
.cat-chip { font-size: 12px; color: var(--ink-soft); background: var(--tag); border-radius: 999px; padding: 4px 11px; }
.cat-chip em { font-style: normal; color: var(--ink-faint); margin-left: 5px; font-size: 11px; }

/* ---------- 板块内页 ---------- */
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: 2px; color: var(--accent); }
.page-head p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.ph-icon {
  width: 58px; height: 58px; flex: 0 0 58px; border-radius: 16px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, #fff);
  display: flex; align-items: center; justify-content: center;
}
.ph-icon svg { width: 36px; height: 36px; display: block; }
.ph-pinyin { font-size: 12px; color: var(--ink-faint); font-weight: 400; margin-left: 10px; letter-spacing: 1px; }

/* 门类内的分组小标题（条目带 group 字段时显示） */
.group-title {
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  margin: 14px 0 10px; padding-left: 11px; position: relative; letter-spacing: .5px;
}
.group-title::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}
.cat-block > .group-title:first-of-type { margin-top: 0; }

.cat-block { margin-bottom: 28px; }
.cat-title { font-size: 15px; font-weight: 700; margin: 0 0 13px; padding-left: 10px; border-left: 3px solid var(--accent); display: flex; align-items: center; gap: 8px; }
.cat-title em { font-style: normal; font-size: 11px; font-weight: 500; color: var(--ink-faint); background: var(--tag); border-radius: 999px; padding: 1px 8px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(264px, 1fr)); gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s, border-color .12s;
  display: flex; flex-direction: column; gap: 8px; text-align: left;
}
.card:hover { transform: translateY(-2px); border-color: #cdd8ee; box-shadow: 0 6px 18px rgba(20,30,50,.10); }
.card-title { font-weight: 600; font-size: 14.5px; }
.card-excerpt { font-size: 13px; color: var(--ink-soft); line-height: 1.65; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.tag { font-size: 11px; color: var(--ink-soft); background: var(--tag); border-radius: 999px; padding: 2px 9px; }
.tag-mod { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, #fff); }

/* 空门类占位 */
.card-empty {
  border: 1px dashed #cfd6e2; background: transparent; box-shadow: none;
  align-items: center; text-align: center; justify-content: center; padding: 22px 16px; cursor: default;
}
.card-empty:hover { transform: none; border-color: #cfd6e2; box-shadow: none; }
.ce-plus { font-size: 24px; color: #c3ccda; line-height: 1; }
.ce-text { font-size: 13px; color: var(--ink-soft); }
.ce-hint { font-size: 11px; color: var(--ink-faint); line-height: 1.6; }
.ce-hint code { background: var(--tag); border-radius: 4px; padding: 1px 5px; font-size: 11px; }

.empty { text-align: center; color: var(--ink-faint); padding: 60px 0; font-size: 14px; line-height: 1.8; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,22,40,.45); }
.modal-card {
  position: relative; background: var(--panel); border-radius: 16px; width: min(660px, 92vw);
  max-height: 84vh; overflow-y: auto; padding: 28px 30px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-close { position: absolute; top: 12px; right: 14px; border: none; background: transparent; font-size: 24px; color: var(--ink-faint); cursor: pointer; line-height: 1; }
.modal-body h2 { margin: 0 0 6px; font-size: 20px; line-height: 1.4; }
.mb-meta { font-size: 12px; color: var(--ink-faint); margin-bottom: 14px; }
.mb-content { font-size: 14.5px; line-height: 1.9; color: var(--ink); white-space: pre-wrap; }
.mb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.breadcrumb { font-size: 12px; color: var(--accent); margin-bottom: 10px; letter-spacing: .5px; }
mark { background: #fff2a8; color: inherit; border-radius: 2px; padding: 0 1px; }

@media (max-width: 720px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .module-nav { flex-direction: row; flex-wrap: wrap; }
  .mi-count { display: none; }
  .sidebar-foot { display: none; }
  .main { height: auto; }
  .topbar { position: static; }
}


/* ---------- 均线智析入口 ---------- */
.junxian-entry { margin-bottom: 22px; }
.jx-launch-card {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border: 1px solid #eceff3; border-radius: 14px;
  padding: 16px 18px; text-decoration: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  transition: transform .12s, border-color .12s;
}
.jx-launch-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.jx-launch-icon { font-size: 28px; width: 44px; text-align: center; flex-shrink: 0; }
.jx-launch-text { flex: 1; }
.jx-launch-title { font-size: 15px; font-weight: 700; color: #1f2937; }
.jx-launch-desc { font-size: 12px; color: #6b7280; margin-top: 4px; }
.jx-launch-btn {
  background: var(--accent); color: #fff; font-size: 13px;
  padding: 8px 16px; border-radius: 8px; font-weight: 600; flex-shrink: 0;
}

/* ---------- 书识入口（知灼 · 标题右上角） ---------- */
.ss-launch {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid #eceff3; border-radius: 12px;
  padding: 10px 14px; text-decoration: none; flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  transition: transform .12s, border-color .12s;
}
.ss-launch:hover { transform: translateY(-2px); border-color: var(--accent); }
.ss-ic { font-size: 22px; line-height: 1; }
.ss-tx { display: flex; flex-direction: column; line-height: 1.3; text-align: left; }
.ss-tx b { font-size: 14px; color: #1f2937; letter-spacing: 2px; }
.ss-tx i { font-style: normal; font-size: 11px; color: #6b7280; }
.ss-go {
  background: var(--accent); color: #fff; font-size: 12px;
  padding: 6px 12px; border-radius: 8px; font-weight: 600; white-space: nowrap;
}
@media (max-width: 720px) {
  .ss-launch { padding: 8px 10px; }
  .ss-tx i { display: none; }
  .ss-tx b { font-size: 13px; letter-spacing: 1px; }
}

/* ---------- 待开放按钮（暂不可点击） ---------- */
.ss-launch.is-wait { cursor: default; }
.ss-launch.is-wait:hover { transform: none; border-color: #eceff3; }

/* ---------- 页脚 ---------- */
.site-foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 14px 30px 16px;
  text-align: center;
}
.sf-line {
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--ink-soft);
  letter-spacing: .3px;
  line-height: 1.6;
}
.sf-meta {
  margin: 0;
  font-size: 11.5px;
  color: var(--ink-faint);
  line-height: 1.6;
}
.sf-sep { margin: 0 9px; opacity: .55; }
.sf-meta a {
  color: var(--ink-faint); text-decoration: none;
  border-bottom: 1px dashed transparent;
}
.sf-meta a:hover { color: var(--accent); border-bottom-color: var(--accent); }
@media (max-width: 720px) {
  .site-foot { padding: 12px 16px 14px; }
  .sf-line { font-size: 11.5px; }
  .sf-meta { font-size: 11px; }
  .sf-sep { margin: 0 6px; }
}
