/* ==========================================================================
   资源库
   版式对齐课程中心：深色、极简、行式列表与长文详情
   仅复用 style.css 的变量与字体栈
   ========================================================================== */

.res-body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
}

.res-page {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 64px;
}

/* ---------- 面包屑 ---------- */
.res-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-subtle);
}

.res-crumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.res-crumb a:hover {
  color: var(--text-primary);
}

.res-crumb .current {
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

/* ---------- 列表头部 ---------- */
.res-list-head {
  padding-bottom: 18px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.res-list-head h1 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.res-list-head p {
  max-width: 620px;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.85;
  color: var(--text-muted);
}

.res-list-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-subtle);
}

/* ---------- 分类筛选（纯 CSS） ---------- */
.res-main {
  position: relative;
}

.res-filter-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.res-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 0 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.res-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

.res-filter-pill span {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-subtle);
}

.res-filter-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.res-filter-input:checked + .res-filter-pill,
.res-filter-input:checked ~ .res-filter .res-filter-pill[for="resCat-all"] {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background-color: var(--bg-surface);
}

/* 选中态：逐个分类声明，保持纯 CSS 筛选 */
#resCat-all:checked ~ .res-filter label[for="resCat-all"],
#resCat-kaichang:checked ~ .res-filter label[for="resCat-kaichang"],
#resCat-fanshi:checked ~ .res-filter label[for="resCat-fanshi"],
#resCat-tuila:checked ~ .res-filter label[for="resCat-tuila"],
#resCat-lenghan:checked ~ .res-filter label[for="resCat-lenghan"],
#resCat-yueyue:checked ~ .res-filter label[for="resCat-yueyue"],
#resCat-huajie:checked ~ .res-filter label[for="resCat-huajie"],
#resCat-shengji:checked ~ .res-filter label[for="resCat-shengji"],
#resCat-scene:checked ~ .res-filter label[for="resCat-scene"] {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background-color: var(--bg-surface);
}

#resCat-kaichang:checked ~ .res-list .res-row:not([data-cat="kaichang"]),
#resCat-fanshi:checked ~ .res-list .res-row:not([data-cat="fanshi"]),
#resCat-tuila:checked ~ .res-list .res-row:not([data-cat="tuila"]),
#resCat-lenghan:checked ~ .res-list .res-row:not([data-cat="lenghan"]),
#resCat-yueyue:checked ~ .res-list .res-row:not([data-cat="yueyue"]),
#resCat-huajie:checked ~ .res-list .res-row:not([data-cat="huajie"]),
#resCat-shengji:checked ~ .res-list .res-row:not([data-cat="shengji"]),
#resCat-scene:checked ~ .res-list .res-row:not([data-cat="scene"]) {
  display: none;
}

/* ---------- 行式列表 ---------- */
.res-list {
  display: flex;
  flex-direction: column;
}

.res-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 14px;
  padding: 18px 2px;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
  color: inherit;
  transition: background-color 0.2s;
}

.res-row:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.res-row.is-page-hidden {
  display: none;
}

.res-row-index {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-top: 2px;
}

.res-row-no {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-subtle);
}

.res-row-cat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 24px;
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  font-family: var(--font-serif);
  font-size: 11px;
  color: var(--text-secondary);
}

.res-row-body {
  min-width: 0;
}

.res-row-body h2 {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.res-row-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.75;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.res-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-subtle);
}

/* ---------- 分页 ---------- */
.res-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding-top: 24px;
}

.res-pager[hidden] {
  display: none;
}

.res-pager-btn {
  padding: 5px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.res-pager-btn:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.res-pager-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.res-pager-info {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-subtle);
}

/* ---------- 详情 ---------- */
.res-article {
  min-width: 0;
  max-width: 820px;
  margin: 0 auto;
}

.res-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.42;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.res-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-subtle);
}

.res-section {
  margin-top: 28px;
}

.res-h2 {
  margin-bottom: 12px;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.res-scenario {
  font-size: 13px;
  line-height: 1.95;
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* 引用块 */
.res-quotes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.res-quote {
  margin: 0;
  padding: 14px 16px;
  border-left: 2px solid var(--border-strong);
  background-color: var(--bg-surface);
}

.res-quote blockquote {
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.9;
  color: var(--text-primary);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.res-quote figcaption {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-subtle);
}

/* 战术拆解 */
.res-tactics {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.res-tactics li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
}

.res-tactics-no {
  padding-top: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-subtle);
}

.res-tactics p {
  font-size: 13px;
  line-height: 1.9;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* 对话气泡 */
.res-dialogs {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.res-dialog-head {
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-subtle);
}

.res-bubbles {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.res-bubble {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 88%;
  padding: 9px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background-color: var(--bg-surface);
}

.res-bubble p {
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.res-bubble-role {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-subtle);
}

.res-bubble-left {
  align-self: flex-start;
}

.res-bubble-right {
  align-self: flex-end;
  background-color: var(--bg-surface-elevated);
}

.res-bubble-note {
  align-self: center;
  max-width: 94%;
  border-style: dashed;
  background-color: transparent;
}

/* 标签 */
.res-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.res-tag {
  padding: 2px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

/* 相邻场景 */
.res-related {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-subtle);
}

.res-related-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
  color: inherit;
}

.res-related-item:hover .res-related-title {
  color: var(--text-primary);
}

.res-related-cat {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-subtle);
}

.res-related-title {
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
  transition: color 0.2s;
}

.res-related-arrow {
  font-size: 11px;
  color: var(--text-subtle);
}

.res-back {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
}

.res-back a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.res-back a:hover {
  color: var(--text-primary);
}

/* ---------- 页脚 ---------- */
.res-footer {
  max-width: 780px;
  margin: 0 auto;
  padding: 26px 20px 40px;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-subtle);
}

.res-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.res-footer a:hover {
  color: var(--text-primary);
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .res-page {
    padding: 20px 14px 52px;
  }

  .res-list-head h1,
  .res-title {
    font-size: 23px;
  }

  .res-row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    padding: 15px 0;
  }

  .res-row-cat {
    width: 34px;
  }

  .res-row-body h2 {
    font-size: 15px;
  }

  .res-quote {
    padding: 12px 13px;
  }

  .res-bubble {
    max-width: 94%;
  }

  .res-footer {
    padding: 22px 14px 36px;
  }
}
