/* ============================================================
   资源信息卡（res_fields）
   颜色/圆角全部走主题变量（--card/--soft/--bd/--tx/--ac/--radius）
   ============================================================ */

.rf-card {
  margin: 0 0 18px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--radius);
}

/* ---------- 左封面 + 右信息 ---------- */
.rf-top {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}
.rf-main {
  display: flex;
  flex-direction: column;
  /* 顶部对齐 + 按钮贴底：封面与右栏同高时，按钮底边与封面底边齐平 */
  justify-content: flex-start;
  gap: 14px;
  min-width: 0;
  /* 右栏最矮高度：行高由它决定，左侧封面随之等高（信息少时也不塌成扁条） */
  min-height: 220px;
}
.rf-cover {
  display: block;
  /* 不锁固定比例：由右栏（信息网格 + 动作按钮）决定行高，封面拉伸到同等高度 */
  position: relative;
  height: 100%;
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
  background: var(--soft);
  text-decoration: none;
}
.rf-cover img {
  /* 绝对定位脱离行高计算：避免图片固有 300px 高度把整行撑高 */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.rf-cover-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 64px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2563EB, #1E40AF);
}

.rf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
}
.rf-item {
  display: flex;
  min-width: 0;
  border: 1px solid var(--bd);
  border-radius: 6px;
  overflow: hidden;
  background: var(--card);
  font-size: 13px;
  line-height: 1.4;
}
.rf-k {
  flex: 0 0 88px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  background: var(--soft);
  color: var(--tx-2);
  font-weight: 600;
  white-space: nowrap;
}
.rf-v {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  color: var(--tx);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rf-item.is-price .rf-v {
  color: #DC2626;
  font-weight: 700;
}

/* ---------- 动作按钮 ---------- */
.rf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
}
.rf-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  background: #2563EB;
}
.rf-act:hover {
  color: #fff;
  filter: brightness(.94);
}

/* ---------- 下载地址 ---------- */
.rf-dl {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--bd);
}
.rf-sec-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--tx);
}
.rf-sec-title svg {
  color: var(--ac);
}
.rf-priv-tip {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: -2px 0 10px;
  font-size: 12px;
  color: var(--tx-3);
}
.rf-priv-tip svg {
  color: var(--ac);
  flex: none;
}
/* 付费解锁提取码 */
.rf-pay {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--ac-soft);
  border-radius: var(--radius);
  background: var(--ac-soft);
}
.rf-pay-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  color: var(--ac-2);
  font-size: 13px;
}
.rf-pay-main svg {
  flex: none;
}
.rf-pay-tip {
  font-weight: 600;
}
.rf-pay-bal {
  color: var(--tx-2);
  font-size: 12.5px;
}
.rf-pay-btn {
  flex: none;
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--ac);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.rf-pay-btn:hover {
  color: #fff;
  filter: brightness(.94);
}
.rf-pay-btn[disabled] {
  opacity: .65;
  cursor: default;
}
.rf-pay-hint {
  margin: -4px 0 10px;
  font-size: 12px;
  color: var(--tx-3);
}
.rf-dl-group {
  margin-bottom: 12px;
}
.rf-dl-group:last-child {
  margin-bottom: 0;
}
.rf-dl-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--tx-2);
}
.rf-dl-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rf-dl-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 16px;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  background: #2563EB;
}
.rf-dl-link:hover {
  color: #fff;
  filter: brightness(.94);
}
/* 下载按钮 + 提取码组合 */
.rf-dl-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rf-code {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid var(--ac-soft);
  border-radius: 6px;
  background: var(--ac-soft);
  color: var(--ac-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.rf-code code {
  font-family: Consolas, "Courier New", monospace;
  font-weight: 700;
  color: var(--ac-2);
  background: #fff;
  border-radius: 4px;
  padding: 1px 6px;
  letter-spacing: .5px;
}
.rf-code:hover {
  border-color: var(--ac);
}
.rf-code-lock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--ac-soft);
  border-radius: 6px;
  background: var(--ac-soft);
  color: var(--ac-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- 截图画廊 ---------- */
.rf-shots-sec {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--bd);
}
.rf-shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.rf-shot {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--bd);
  border-radius: 6px;
  overflow: hidden;
  background: var(--soft);
  cursor: zoom-in;
}
.rf-shot::after {
  content: "查看大图";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 10px 8px;
  background: linear-gradient(transparent, rgba(15, 23, 42, .72));
  color: #fff;
  font-size: 12px;
  text-align: center;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}
.rf-shot:hover::after,
.rf-shot:focus-visible::after {
  opacity: 1;
}
.rf-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s ease;
}
.rf-shot:hover img {
  transform: scale(1.04);
}

/* ---------- 颜色（动作按钮与下载按钮共用） ---------- */
.rf-blue { background: #2563EB; }
.rf-green { background: #16A34A; }
.rf-red { background: #DC2626; }
.rf-orange { background: #EA580C; }
.rf-ghost {
  background: var(--soft);
  color: var(--tx);
  border: 1px solid var(--bd);
}
.rf-ghost:hover {
  color: var(--ac);
  border-color: var(--ac);
}

/* ---------- 发帖 / 编辑表单（由脚本移动到提交按钮之前） ---------- */
.rf-form {
  margin: 0;
  padding: 16px 0 0;
  border-top: 1px dashed var(--bd);
}
.rf-form-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}
.rf-form-head h3 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--tx);
}
.rf-form-head svg {
  color: var(--ac);
}
/* 大小/价格/封面上传：表单行内组合 */
.rf-size-row,
.rf-price-row {
  display: flex;
  gap: 8px;
}
.rf-size-row input,
.rf-price-row select {
  flex: 1;
  min-width: 0;
}
.rf-size-row select {
  flex: 0 0 84px;
}
.rf-price-row input {
  flex: 0 0 120px;
}
.rf-cover-edit {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.rf-cover-prev {
  flex: 0 0 60px;
  width: 60px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--bd);
  border-radius: 6px;
  overflow: hidden;
  background: var(--soft);
  color: var(--tx-3);
}
.rf-cover-prev img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.rf-cover-ctrl {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rf-cover-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* 下载地址逐行编辑器 */
.rf-dl-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.rf-dl-edit-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1.6fr) 90px 34px;
  grid-template-areas:
    "group label url color del"
    "code code reply reply reply";
  gap: 8px;
  align-items: center;
}
.rf-dl-edit-row input,
.rf-dl-edit-row select {
  min-width: 0;
}
.rf-dl-g { grid-area: group; }
.rf-dl-l { grid-area: label; }
.rf-dl-url { grid-area: url; }
.rf-dl-c { grid-area: color; }
.rf-dl-code { grid-area: code; }
/* 注意：app.css 的 `.field label{display:block}`（0,1,1）会盖掉单类选择器，
   这里必须用 `.rf-form .field label.rf-dl-reply` 提高权重，否则开关退化、
   文字被压扁（表现为「回复可见」显示不全、点击也没有滑动动画） */
.rf-form .field label.rf-dl-reply {
  grid-area: reply;
  justify-self: start;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: max-content;
  height: 36px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--bd);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  color: var(--tx-2);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.rf-form .field label.rf-dl-reply > span {
  flex: none;
  white-space: nowrap;
}
.rf-dl-reply input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.rf-dl-reply-track {
  position: relative;
  flex: none;
  width: 30px;
  height: 18px;
  border-radius: 999px;
  background: var(--bd-2);
  transition: background .2s;
}
.rf-dl-reply-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .25);
  transition: transform .2s;
}
.rf-dl-reply input:checked + .rf-dl-reply-track {
  background: var(--ac);
}
.rf-dl-reply input:checked + .rf-dl-reply-track::after {
  transform: translateX(12px);
}
.rf-dl-reply input:focus-visible + .rf-dl-reply-track {
  outline: 2px solid var(--ac);
  outline-offset: 2px;
}
.rf-dl-del {
  grid-area: del;
  justify-self: end;
  width: 34px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--bd);
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--tx-3);
  line-height: 1;
  cursor: pointer;
}
.rf-dl-del:hover {
  border-color: #DC2626;
  color: #DC2626;
}
/* 底部动作按钮逐行编辑 */
.rf-act-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.rf-act-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.rf-act-row input {
  flex: 1 1 160px;
  min-width: 0;
}
.rf-act-row .rf-act-url {
  flex: 2 1 240px;
}
.rf-act-row select {
  flex: 0 0 90px;
}
.rf-act-row .rf-dl-del {
  flex: none;
}
/* 版本截图上传 */
.rf-shot-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.rf-shot-edit:empty {
  display: none;
}
.rf-shot-edit-item {
  position: relative;
  width: 120px;
  height: 90px;
  border: 1px solid var(--bd);
  border-radius: var(--radius-s);
  overflow: hidden;
  background: var(--soft);
}
.rf-shot-edit-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.rf-shot-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, .65);
  color: #fff;
  line-height: 1;
  cursor: pointer;
}
.rf-shot-del:hover {
  background: #DC2626;
}
.rf-shot-ctrl {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.rf-shot-ctrl .form-hint {
  margin: 0;
}
.rf-form .btn.is-busy,
.rf-form .btn[disabled] {
  opacity: .6;
  cursor: default;
}

/* ---------- 手机端 ---------- */
@media (max-width: 760px) {
  .rf-top {
    grid-template-columns: minmax(0, 1fr);
  }
  .rf-cover {
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
  }
  .rf-main {
    min-height: 0;
  }
  .rf-k {
    flex-basis: 80px;
  }
  .rf-dl-edit-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "group label"
      "url url"
      "color code"
      "reply del";
  }
}
