/* 资源区（下载中心）样式。只用 base.css 的变量和组件。 */

/* ---------- 星级 ---------- */
.stars { position: relative; display: inline-block; font-size: 14px; line-height: 1; letter-spacing: 1px; white-space: nowrap; vertical-align: -1px; }
.stars::before { content: "★★★★★"; color: var(--line); }
.stars-fill { position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap; }
.stars-fill::before { content: "★★★★★"; color: #c98a0b; }

/* ---------- 列表页：左分类树 + 主区网格 ---------- */
.res-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.res-aside .block { margin-bottom: var(--gap); }

.res-tree-list, .res-tree-list ul { list-style: none; margin: 0; padding: 0; }
.res-tree-list > li { border-top: 1px solid var(--line-2); }
.res-tree-list > li:first-child { border-top: 0; }
.res-tree-list summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; list-style: none; padding: 0 12px 0 14px; }
.res-tree-list summary::-webkit-details-marker { display: none; }
.res-tree-list summary::after { content: "+"; color: var(--ink-3); width: 14px; text-align: center; order: 3; }
.res-tree-list details[open] > summary::after { content: "−"; }
.res-tree-list summary:hover, .res-tree-leaf:hover, .res-tree-list ul li:hover { background: var(--surface-2); }
.res-tree-list a { display: block; flex: 1; min-width: 0; padding: 8px 0; color: var(--ink); }
.res-tree-list a:hover { text-decoration: none; color: var(--roundel); }
.res-tree-list a[aria-current="page"] { font-weight: 600; color: var(--roundel); }
.res-tree-leaf { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 14px; }
.res-tree-list ul li { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 28px; font-size: var(--fs-s); border-top: 1px solid var(--line-2); }
.res-tree-list ul a { padding: 6px 0; color: var(--ink-2); }
.res-count { color: var(--ink-3); font-size: var(--fs-s); min-width: 2em; text-align: right; }

.res-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.res-tag { display: inline-block; padding: 1px 8px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-tag); color: var(--ink-2); font-size: var(--fs-s); }
.res-tag:hover { background: #fff; border-color: var(--roundel); color: var(--roundel); text-decoration: none; }
.res-kv + .res-tags { border-top: 1px solid var(--line-2); }

.res-search { display: flex; gap: 8px; margin-bottom: 12px; }
.res-search input[type="search"] { flex: 1; min-width: 0; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--surface); }
.res-search input[type="search"]:focus { border-color: var(--roundel); box-shadow: var(--focus); outline: none; }
.res-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin-bottom: 12px; }
.res-total { margin: 0 auto 0 0; color: var(--ink-2); font-size: var(--fs-s); }
.res-total strong { color: var(--ink); font-size: var(--fs); }
.res-opts { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-btn); padding: 2px; }
.res-opts a { padding: 3px 10px; font-size: var(--fs-s); color: var(--ink-2); border-radius: 2px; }
.res-opts a:hover { background: var(--surface-2); text-decoration: none; }
.res-opts a[aria-current] { background: var(--steel); color: #fff; }

/* ---------- 网格卡片 ---------- */
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(206px, 1fr)); gap: 12px; }
.res-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-block); overflow: hidden; min-width: 0; }
.res-card:hover, .res-card:focus-within { border-color: var(--steel-2); }
.res-cover { display: block; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.res-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.res-cover-empty { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--ink-3); font-size: var(--fs-s); }
.res-badge, .res-flag { position: absolute; top: 8px; font-size: var(--fs-xs); line-height: 18px; padding: 0 6px; border-radius: var(--r-tag); font-weight: 500; pointer-events: none; }
.res-badge { left: 8px; background: rgba(20, 38, 54, .86); color: #fff; }
.res-flag { right: 8px; background: var(--taxiway); color: var(--night); }
.res-card-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.res-card-title { font-size: var(--fs); font-weight: 600; line-height: 1.4; }
.res-card-title a { color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.res-card-title a:hover { color: var(--roundel); }
.res-card-author { font-size: var(--fs-s); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-card-stats { margin-top: auto; padding-top: 6px; display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-s); color: var(--ink-3); }
.res-stat b { color: var(--ink-2); font-weight: 500; }
.res-stat-none { color: var(--ink-3); }
.res-grid-compact { padding: 0; }

/* 侧栏「最新资源」 */
.res-mini { list-style: none; margin: 0; padding: 0; }
.res-mini li { display: flex; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line-2); align-items: center; }
.res-mini li:first-child { border-top: 0; }
.res-mini-cover { flex: none; width: 64px; height: 48px; background: var(--surface-2); border-radius: var(--r-tag); overflow: hidden; }
.res-mini-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.res-mini-title { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); font-size: var(--fs-s); line-height: 1.4; }

/* ---------- 详情页 ---------- */
.page-actions form { margin: 0; }
.res-detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "hero info" "content info"; gap: var(--gap); align-items: start; }
.res-hero { grid-area: hero; min-width: 0; }
.res-info { grid-area: info; min-width: 0; }
.res-content { grid-area: content; min-width: 0; }

.res-hero-main { display: block; background: var(--night); border: 1px solid var(--line); border-radius: var(--r-block); overflow: hidden; aspect-ratio: 16 / 9; cursor: zoom-in; }
.res-hero-main img { display: block; width: 100%; height: 100%; object-fit: contain; }
.res-hero-empty { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-block); color: var(--ink-3); }
.res-thumbs { list-style: none; margin: 8px 0 0; padding: 0; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.res-thumbs a { display: block; width: 92px; aspect-ratio: 4 / 3; border: 2px solid transparent; border-radius: var(--r-btn); overflow: hidden; background: var(--surface-2); }
.res-thumbs a:hover { border-color: var(--steel-2); }
.res-thumbs img { display: block; width: 100%; height: 100%; object-fit: cover; }

.res-dl .block-body { padding: 14px; }
.res-dl-btn { width: 100%; height: 46px; font-size: var(--fs-m); }
.res-dl-file { margin: 8px 0 0; font-size: var(--fs-s); color: var(--ink-2); word-break: break-all; }
.res-file-size { color: var(--ink-3); font-size: var(--fs-s); white-space: nowrap; }
.res-dl-none { color: var(--ink-3); margin: 0; }
.res-files-title { font-size: var(--fs); margin-bottom: 8px; }
.res-files { list-style: none; margin: 0; padding: 0; }
.res-files li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-2); }
.res-files li:first-child { border-top: 0; padding-top: 0; }
.res-file-name { word-break: break-all; font-size: var(--fs-s); }
.res-kv { padding: 12px 14px; border-top: 1px solid var(--line-2); gap: 8px 12px; }
.res-kv dd { min-width: 0; word-break: break-word; }
.res-dl .res-tags { padding: 12px 14px; }
.res-source .kv { gap: 6px 12px; }
.res-source .form-hint { margin-top: 10px; }

.res-tabnav { display: flex; gap: 2px; margin-bottom: 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.res-tabnav a { padding: 8px 16px; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.res-tabnav a:hover { background: var(--surface); text-decoration: none; color: var(--ink); }
.res-tabnav a[aria-current="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--steel); background: var(--surface); }
.res-tabnav { display: none; }
.js-tabs .res-tabnav { display: flex; }
.js-tabs .res-panel { display: none; }
.js-tabs .res-panel.is-active { display: block; }
.js-tabs .res-panel > .block-head { display: none; }

.res-lead { font-size: var(--fs-m); color: var(--ink-2); margin-bottom: 12px; }
.res-prose { max-width: 720px; overflow-wrap: anywhere; }
.res-prose img { max-width: 100%; height: auto; }

/* 简介翻译（仿 X 的「翻译帖子」）：正文下一行小字；点了转圈，译文淡入、高度平滑过渡 */
.res-tr-stage.is-swapping { overflow: hidden; transition: height .28s ease; }
.res-orig, .res-tr { transition: opacity .16s ease; }
.res-orig.is-faded, .res-tr.is-faded { opacity: 0; }
.res-tr-body { white-space: pre-line; }
.res-tr-cut { margin: 8px 0 0; font-size: var(--fs-s); color: var(--ink-3); }
.res-tr-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-height: 20px; margin-top: 14px; font-size: var(--fs-s); color: var(--ink-3); }
.res-tr-icon { flex: none; }
.res-tr-bar > [hidden] { display: none; }
.res-tr-deepl { flex: none; display: block; width: auto; height: 18px; }
.res-tr-form { display: inline; margin: 0; }
.res-tr-link { padding: 0; border: 0; background: none; font: inherit; color: var(--roundel); cursor: pointer; }
.res-tr-link:hover { text-decoration: underline; }
.res-tr-link:focus-visible { outline: 2px solid var(--roundel); outline-offset: 2px; border-radius: 2px; }
.res-tr-busy { display: inline-flex; align-items: center; gap: 8px; }
.res-tr-spin { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--roundel); border-radius: 50%; animation: res-tr-spin .7s linear infinite; }
@keyframes res-tr-spin { to { transform: rotate(360deg); } }
.res-tr-err { color: var(--danger); }
@media (prefers-reduced-motion: reduce) {
  .res-tr-spin { animation-duration: 2s; }
  .res-orig, .res-tr, .res-tr-stage.is-swapping { transition: none; }
}
.res-version { padding: 12px 0; border-top: 1px solid var(--line-2); }
.res-version:first-child { border-top: 0; padding-top: 0; }
.res-version h3 { font-size: var(--fs); margin-bottom: 6px; }
.res-version-time { font-weight: 400; font-size: var(--fs-s); color: var(--ink-3); margin-left: 8px; }
.res-version-files { list-style: none; margin: 8px 0 0; padding: 0; font-size: var(--fs-s); }

.res-review-form { max-width: none; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line-2); }
.res-rate { border: 0; padding: 0; margin: 0 0 12px; }
.res-rate legend { font-weight: 500; padding: 0; margin-bottom: 4px; }
.res-rate-stars { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; }
.res-rate-stars label { font-size: 30px; line-height: 1; color: var(--line); cursor: pointer; padding: 2px 3px; }
.res-rate-stars input:checked ~ label, .res-rate-stars label:hover, .res-rate-stars label:hover ~ label { color: #c98a0b; }
.res-rate-stars input:focus-visible + label { box-shadow: var(--focus); border-radius: var(--r-btn); }
.res-reviews { list-style: none; margin: 0; padding: 0; }
.res-review { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.res-review:first-child { border-top: 0; }
.res-review-main { flex: 1; min-width: 0; }
.res-review-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-bottom: 4px; }
.res-review-main form { margin: 4px 0 0; }
.res-actions { margin-top: 4px; }

/* ---------- 发布表单 ---------- */
.res-form { max-width: 720px; }
.res-form input[type="file"] { width: 100%; padding: 6px; border: 1px dashed var(--line); border-radius: var(--r-btn); background: var(--surface-2); }
.res-form fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.res-shots-edit ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.res-shots-edit img { border-radius: var(--r-tag); object-fit: cover; }
.res-shots-edit .check { flex-direction: column; align-items: flex-start; gap: 4px; font-size: var(--fs-s); }

/* ---------- 灯箱 ---------- */
.res-lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; overflow: visible; color: #fff; }
.res-lightbox::backdrop { background: rgba(10, 20, 30, .9); }
.res-lightbox img { display: block; max-width: 94vw; max-height: 84vh; margin: 0 auto; }
.res-lightbox-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; }
.res-lightbox button { min-width: 44px; height: 44px; border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .1); color: #fff; border-radius: var(--r-btn); cursor: pointer; font-size: var(--fs); }
.res-lightbox button:hover { background: rgba(255, 255, 255, .22); }

/* ---------- 后台 ---------- */
.res-adm-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; }
.res-adm-form .input { width: 200px; }
.res-adm-form .select { width: 200px; }
.res-adm-form .res-adm-sort { width: 84px; }
.res-adm-row.is-child { padding-left: 38px; background: var(--surface-2); }
.res-adm-row form { margin: 0; }
.wtlc-kv { max-width: 560px; margin-bottom: 14px; }

/* ---------- 窄屏 ---------- */
@media (max-width: 900px) {
  .res-detail { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "info" "content"; }
}
@media (max-width: 767px) {
  .res-layout { grid-template-columns: minmax(0, 1fr); }
  .res-aside { order: 2; } /* 手机上先看资源，分类和标签放到列表下面 */
  .res-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .res-card-body { padding: 6px 8px 8px; }
  .res-card-stats { flex-direction: column; gap: 2px; }
  .res-total { flex-basis: 100%; }
  .res-toolbar { gap: 8px; }
  .res-opts { overflow-x: auto; max-width: 100%; }
  .res-adm-form .input, .res-adm-form .select { width: 100%; }
  .res-adm-form .res-adm-sort { width: 100%; }
  .res-adm-row { flex-wrap: wrap; }
  .res-adm-row.is-child { padding-left: 24px; }
}
@media (max-width: 359px) {
  .res-grid { grid-template-columns: minmax(0, 1fr); }
}
