/*!
 * 万能墙（lhuiye.cn） — SPDX-License-Identifier: LicenseRef-Proprietary
 * Copyright (c) 2026 辉夜 <18759765356@163.com> 保留所有权利
 * 第三方组件保留各自许可（见 THIRD_PARTY_NOTICES.md）
 */
/* ==================================================================
   SVG 头像框 · 插件样式
   ------------------------------------------------------------------
   两件事：
     1. 全站头像装饰（.af-badge 包住原头像，SVG 叠加在上层）
     2. 设置页选择面板

   注意：站点的 Tailwind 是按实际用到的类裁剪过的，所以这里全部写普通
   CSS、类名一律 af- 前缀，不依赖任何 Tailwind 工具类。
   站点有「极速模式」 html[data-perf="lite"] 会关动画，下面已适配。
   ================================================================== */

/* ---------------- 一、全站头像装饰 ---------------- */

.af-badge {
  --af-size: 48px;
  position: relative;
  display: inline-block;
  width: var(--af-size);
  height: var(--af-size);
  flex: 0 0 auto;
  line-height: 0;
  vertical-align: middle;
}

/* 原头像照旧，只是被包了一层；用 :where() 保持优先级为 0，不干扰站点既有样式 */
.af-badge > .af-badge-av {
  position: absolute;
  inset: 10%;
  display: block;
  line-height: 0;
}
.af-badge > .af-badge-av > img,
.af-badge > .af-badge-av > .avatar,
.af-badge > .af-badge-av > .rk-avatar,
.af-badge > .af-badge-av > .rk-pod-avatar,
.af-badge > .af-badge-av > .avatar-lg > img {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  object-fit: cover;
  display: block;
  margin: 0 !important;
}
/* 首字色块兜底：站点用 <div class="avatar">首字</div> 这类结构 */
.af-badge > .af-badge-av > div {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 叠加的头像框：永远不吃鼠标事件，避免盖住头像上的链接/按钮 */
.af-badge > svg {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  overflow: visible;
  pointer-events: none;
  user-select: none;
  display: block;
}

/* 插件自己造的占位头像（设置页/个人主页预览用） */
.af-avatar-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #c7d2fe, #a7f3d0);
  color: #334155;
  font-weight: 700;
  font-size: calc(var(--af-size, 48px) * 0.34);
  line-height: 1;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 极速模式：站内会关掉绝大多数动效，头像框也一起静止 */
html[data-perf="lite"] .af-badge > svg,
html[data-perf="lite"] .af-badge > svg * {
  animation: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .af-badge > svg,
  .af-badge > svg * {
    animation: none !important;
  }
}

/* 装饰器补位时的过渡，避免头像"跳"一下 */
.af-badge.is-fresh {
  animation: af-pop 0.32s ease-out;
}
@keyframes af-pop {
  from { transform: scale(0.86); opacity: 0.4; }
  to   { transform: scale(1);    opacity: 1; }
}

/* SVG 内部的动效由素材库自带的 class 驱动（.af-rotor/.af-glow/.af-pulse），
   这里给出与素材库一致的 keyframes；站点若已定义同名规则也不会冲突。 */
@keyframes af-spin  { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes af-glow  { 0%,100% { opacity: .72; } 50% { opacity: 1; } }
@keyframes af-pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.af-badge svg .af-rotor {
  transform-box: view-box;
  transform-origin: 50% 50%;
  animation: af-spin 18s linear infinite;
}
.af-badge svg .af-glow  { animation: af-glow 3s ease-in-out infinite; }
.af-badge svg .af-pulse { animation: af-pulse 2.4s ease-in-out infinite; }

/* ---------------- 二、选择面板（画廊式卡片） ----------------
   名字改成编号、简介清空之后，卡片的主体应该是「头像框预览图」本身 ——
   所以卡片改成竖向：大预览在上，编号与获取条件在下，靠视觉辨认而不是靠文字。
   ---------------------------------------------------------------- */

.af-card { font-family: inherit; }

.af-new-tip {
  margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; font-size: 13px;
  color: #7c2d12; background: linear-gradient(90deg, #fff7ed, #fef3c7); border: 1px solid #fcd34d;
}

.af-next {
  margin: 0 0 16px; padding: 12px 14px; border-radius: 14px;
  background: var(--card-soft, rgba(127, 127, 127, 0.06));
  border: 1px solid var(--border-soft, rgba(127, 127, 127, 0.16));
}
.af-next-done { font-size: 13px; }
.af-next-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; margin-bottom: 8px; flex-wrap: wrap; }
.af-next-gap b { color: var(--primary, #7e57c2); font-size: 15px; }
.af-bar { height: 7px; border-radius: 99px; background: rgba(127, 127, 127, 0.18); overflow: hidden; }
.af-bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary, #7e57c2), var(--secondary, #a78bfa)); transition: width 0.4s ease; }
.af-next-hint { margin-top: 8px; font-size: 11.5px; opacity: 0.72; line-height: 1.7; }

.af-grid { display: flex; flex-direction: column; gap: 16px; }

.af-series {
  --af-accent: #94a3b8; border: 1px solid var(--border-soft, rgba(127, 127, 127, 0.16));
  border-radius: 16px; padding: 14px 14px 16px;
}
.af-series.is-locked { opacity: 0.62; }
.af-series-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.af-series-name { font-size: 14.5px; font-weight: 700; display: inline-flex; align-items: center; }
.af-series-name::before { content: ""; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--af-accent); box-shadow: 0 0 8px var(--af-accent); }
.af-series-desc { font-size: 11.5px; opacity: 0.62; }
.af-series-lock { margin-left: auto; font-size: 11px; padding: 1px 8px; border-radius: 99px; color: #b45309; background: #fffbeb; border: 1px solid #fcd34d; }
.af-series-foot { margin: 12px 2px 0; font-size: 11.5px; opacity: 0.72; line-height: 1.7; }

/* 画廊网格：小屏 3 列，中大屏按宽度自适应 */
.af-opts {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px;
}

.af-opt {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px 10px; border: 1.5px solid var(--border-soft, rgba(127, 127, 127, 0.16));
  border-radius: 14px; background: transparent; cursor: pointer; font: inherit; color: inherit;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.af-opt:hover:not(:disabled) { border-color: var(--af-accent); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15, 23, 42, 0.10); }
.af-opt.is-on { border-color: var(--af-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--af-accent) 22%, transparent); background: color-mix(in srgb, var(--af-accent) 7%, transparent); }
.af-opt.is-on::after { content: "✓"; position: absolute; right: 7px; top: 6px; font-size: 12px; font-weight: 800; color: var(--af-accent); }
.af-opt.is-off { cursor: not-allowed; filter: grayscale(0.78); }

/* 预览图：卡片主体，尽量大 */
.af-opt-av { --af-size: 62px; position: relative; width: var(--af-size); height: var(--af-size); flex: 0 0 auto; display: block; }
.af-opt-av > svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* 【必须显式给宽高】.af-avatar-ph 自带 width/height:100%，只写 inset 会与之冲突：
   绝对定位下 left/right/width 同时给出时 right 被忽略 → 占位头像右下偏移 10%（曾导致
   选择面板里框与头像错位、而帖子/评论用 .af-badge-av 所以正常）。 */
.af-opt-av > .af-avatar-ph { position: absolute; inset: 10%; width: 80%; height: 80%; }

.af-opt-txt { display: flex; flex-direction: column; align-items: center; min-width: 0; width: 100%; }
.af-opt-txt > b { font-size: 12px; font-weight: 700; letter-spacing: .02em; opacity: .9; }
/* 简介已清空 —— 不留空行，避免卡片被撑出空档 */
.af-opt-txt > i { display: none; }
.af-opt-src { font-style: normal; font-size: 12px; font-weight: 600; opacity: .9; margin-top: 1px; }
.af-empty { margin: 4px 0; font-size: 12px; opacity: .6; }

.af-tag {
  position: absolute;
  top: -7px;
  right: 7px;
  font-size: 10px;
  line-height: 1.7;
  padding: 0 6px;
  border-radius: 99px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.af-tag-admin { color: #6b21a8; background: #faf5ff; border-color: #d8b4fe; }
.af-tag-super { color: #fff; background: linear-gradient(90deg, #d4a72c, #b07bff); border-color: #d4a72c; }
.af-tag-lock  { color: #64748b; background: #f8fafc; border-color: #e2e8f0; }
.af-tag-grant { color: #047857; background: #ecfdf5; border-color: #6ee7b7; }
.af-tag-buy   { top: auto; bottom: 6px; right: 6px; color: #b45309; background: #fffbeb; border-color: #fcd34d; }

.af-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.af-btn {
  font: inherit;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border-soft, rgba(127, 127, 127, 0.22));
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.af-btn-plain.is-on { border-color: var(--primary, #7e57c2); font-weight: 600; }
.af-status { font-size: 12.5px; opacity: 0.8; }
.af-status.is-ok { color: #16a34a; opacity: 1; }
.af-status.is-err { color: #dc2626; opacity: 1; }

/* 个人主页卡片 */
.af-profile-body { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.af-profile-meta { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.af-profile-meta > b { font-size: 14px; }
.af-profile-meta > span { opacity: 0.66; }
.af-link { color: var(--primary, #7e57c2); text-decoration: none; font-weight: 600; }

@media (max-width: 380px) {
  .af-opts { grid-template-columns: repeat(2, 1fr); }
  .af-opt-av { --af-size: 54px; }
}

/* ===== 四大分类的补充样式 ===== */
.af-opt-src { font-style: normal; font-size: 10px; opacity: .85; margin-top: 1px; }
.af-series-foot { margin: 10px 2px 0; font-size: 11.5px; opacity: .72; line-height: 1.7; }
.af-empty { margin: 4px 0; font-size: 12px; opacity: .6; }
