/* ============================================================
   百合游戏展厅 / Yuri Game Gallery
   ============================================================ */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "Source Han Serif",
    "Yu Mincho", "Hiragino Mincho ProN", "SimSun", Georgia, serif;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;

  --shadow-1: 0 1px 2px rgba(60, 30, 45, .06), 0 4px 14px rgba(60, 30, 45, .05);
  --shadow-2: 0 2px 6px rgba(60, 30, 45, .08), 0 14px 40px rgba(60, 30, 45, .12);
  --shadow-3: 0 10px 30px rgba(30, 10, 22, .18), 0 40px 90px rgba(30, 10, 22, .22);

  --ease: cubic-bezier(.22, .61, .36, 1);

  /* 设置面板用：不透明度 / 背景亮度 / 背景模糊 / 背景图（默认无） */
  --ui-alpha: 1;
  --bg-bright: 1;
  --bg-blur: 0px;
  --bg-img: none;
  --bg-veil: 0.2;   /* 背景图上的一层薄色罩，压一压对比度让文字更好读 */
}

[data-theme="light"] {
  --bg: #fbf8f6;
  --bg-tint: #f4ede9;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-2: #f7f1ee;
  --surface2-solid: #f7f1ee;
  --surface-3: #efe5e0;
  --surface3-solid: #efe5e0;
  --border: #ebdfd9;
  --border-strong: #dcc9c1;
  --text: #251a20;
  --text-2: #5e4c55;
  --text-3: #9a858f;
  --accent: #c2427c;
  --accent-2: #e07aa6;
  --accent-soft: #fceaf2;
  --accent-line: #f3cfdf;
  --ok: #4b8f6a;
  --warn: #c08a2e;
  --info: #5b7fb8;
  --muted-badge: #8b7d85;
  --cover-bg: #efe5e0;
  --grid-line: rgba(120, 80, 100, .08);
}

[data-theme="dark"] {
  --bg: #131017;
  --bg-tint: #1a1520;
  --surface: #1d1825;
  --surface-solid: #1d1825;
  --surface-2: #241e2d;
  --surface2-solid: #241e2d;
  --surface-3: #2c2536;
  --surface3-solid: #2c2536;
  --border: #322a3d;
  --border-strong: #443553;
  --text: #f3ecf3;
  --text-2: #c3b4c6;
  --text-3: #8a7c92;
  --accent: #f07aae;
  --accent-2: #ff9dc6;
  --accent-soft: #35202e;
  --accent-line: #4a2b3d;
  --ok: #6fbf92;
  --warn: #e0b45e;
  --info: #8aa8de;
  --muted-badge: #9c8fa6;
  --cover-bg: #2a2333;
  --grid-line: rgba(255, 255, 255, .07);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .35), 0 14px 40px rgba(0, 0, 0, .4);
  --shadow-3: 0 10px 30px rgba(0, 0, 0, .5), 0 40px 90px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 500px at 12% -8%, var(--accent-soft), transparent 62%),
    radial-gradient(700px 420px at 96% 4%, var(--bg-tint), transparent 58%);
  opacity: .9;
}

[data-theme="dark"] body::before { opacity: .55; }

/* ---------- 自定义背景（设置面板） ----------
   html.has-bg 时，背景图铺在渐变下面；面板颜色改由 --surface-solid + --ui-alpha 合成，
   透明度拉低就能看见背景。没设背景图时走原来的纯色逻辑，一点不受影响。 */
html.has-bg body { background: transparent; }

html.has-bg body::before {
  background:
    radial-gradient(900px 500px at 12% -8%, var(--accent-soft), transparent 62%),
    radial-gradient(700px 420px at 96% 4%, var(--bg-tint), transparent 58%),
    linear-gradient(color-mix(in srgb, var(--bg) calc(var(--bg-veil) * 100%), transparent),
                    color-mix(in srgb, var(--bg) calc(var(--bg-veil) * 100%), transparent)),
    var(--bg-img);
  background-size: auto, auto, auto, cover;
  background-position: center, center, center, center;
  background-attachment: scroll, scroll, scroll, fixed;
  background-repeat: no-repeat;
  opacity: 1;
  filter: brightness(var(--bg-bright)) blur(var(--bg-blur));
  transform: scale(1.04);
}

[data-theme="dark"] html.has-bg body::before { opacity: 1; }

html.has-bg {
  --surface: color-mix(in srgb, var(--surface-solid) calc(var(--ui-alpha) * 100%), transparent);
  --surface-2: color-mix(in srgb, var(--surface2-solid) calc(var(--ui-alpha) * 100%), transparent);
  --surface-3: color-mix(in srgb, var(--surface3-solid) calc(var(--ui-alpha) * 100%), transparent);
}

/* 半透明面板上叠一层毛玻璃，字才不会糊在背景图里 */
html.has-bg .card,
html.has-bg .sidebar,
html.has-bg .main-head,
html.has-bg .stats-card,
html.has-bg .modal-card,
html.has-bg .modal-panel,
html.has-bg .viewbar,
html.has-bg .stat-card {
  backdrop-filter: blur(12px) saturate(120%);
}

/* ---------- 全局圆角（设置面板） ---------- */
html[data-radius="none"] { --r-sm: 0px; --r-md: 0px; --r-lg: 0px; --r-xl: 2px; }
html[data-radius="sm"]   { --r-sm: 4px; --r-md: 7px; --r-lg: 10px; --r-xl: 14px; }
html[data-radius="lg"]   { --r-sm: 10px; --r-md: 16px; --r-lg: 22px; --r-xl: 30px; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

.ico {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  flex: none;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 26px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }

.brand-mark {
  width: 38px; height: 38px;
  flex: none;
  border-radius: 12px;
  background: url("./brand.png") center / cover no-repeat;
  box-shadow: 0 2px 10px rgba(28, 22, 34, .22), 0 0 0 1px rgba(255, 255, 255, .10) inset;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--font-serif); font-size: 17px; letter-spacing: .06em; }
.brand-text em {
  font-style: normal; font-size: 9.5px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--text-3);
}

.search-wrap {
  position: relative; flex: 1; max-width: 460px;
  display: flex; align-items: center;
}
.search-wrap .ico {
  position: absolute; left: 12px; color: var(--text-3); pointer-events: none;
  width: 16px; height: 16px;
}
.search-wrap input {
  width: 100%;
  padding: 9px 46px 9px 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  appearance: none;
}
.search-wrap input::-webkit-search-cancel-button { display: none; }
.search-wrap input:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent);
}
.search-wrap kbd {
  position: absolute; right: 10px;
  font-family: var(--font-sans); font-size: 10px;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  background: var(--surface-2);
}

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.seg {
  display: flex; gap: 2px; padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.seg-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12.5px;
  transition: background .18s, color .18s;
}
.seg-btn .ico { width: 15px; height: 15px; }
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-1);
}

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: color .18s, border-color .18s, transform .18s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent-line); transform: translateY(-1px); }
.icon-btn.is-active { color: var(--accent); border-color: var(--accent-line); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  transition: background .18s, color .18s, border-color .18s, transform .12s, box-shadow .18s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn .ico { width: 16px; height: 16px; }

.btn-primary {
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 3px 12px color-mix(in srgb, var(--accent) 34%, transparent);
}
.btn-primary:hover { box-shadow: 0 5px 18px color-mix(in srgb, var(--accent) 44%, transparent); }

.btn-ghost {
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent-line); }

.btn-danger { background: transparent; color: #cf4664; border: 1px solid color-mix(in srgb, #cf4664 32%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, #cf4664 10%, transparent); }

.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: var(--r-sm); }

.text-btn { color: var(--text-3); font-size: 12px; }
.text-btn:hover { color: var(--accent); }

/* ---------------- 布局 ---------------- */
.layout {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 226px minmax(0, 1fr);
  gap: 30px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px 26px 70px;
  align-items: start;
}

/* ---------------- 侧栏 ---------------- */
.sidebar {
  position: sticky; top: 76px;
  display: flex; flex-direction: column; gap: 20px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.side-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--text-3);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.filter-block h3 {
  margin: 0 0 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .02em;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chips-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}
.chips-grid .chip {
  justify-content: center;
  padding: 3px 4px;
  font-size: 11px;
  border-radius: 7px;
  letter-spacing: -.01em;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.chips-grid .chip i { font-size: 10px; }
/* 标签个数不是 3 的倍数时，最后一项就按自身宽度排，不拉满整行 */
.chips-scroll { max-height: 320px; overflow-y: auto; padding-right: 2px; }
.chips-scroll::-webkit-scrollbar { width: 4px; }
.chips-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: all .16s;
}
.chip:hover { border-color: var(--accent-line); color: var(--accent); }
.chip.is-on {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
  font-weight: 500;
}
.chip i {
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.chip.is-on i { color: color-mix(in srgb, var(--accent) 70%, transparent); }

.chip .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
  flex: none;
}

.select {
  width: 100%;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: var(--text-2);
  outline: none;
  cursor: pointer;
  transition: border-color .16s;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 26px;
}
.select:hover, .select:focus { border-color: var(--accent-line); }

.switch-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-2);
  cursor: pointer; user-select: none;
}
.switch-row input {
  appearance: none;
  width: 32px; height: 18px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  flex: none;
}
.switch-row input::after {
  content: "";
  position: absolute; top: 1px; left: 1px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s var(--ease);
}
.switch-row input:checked { background: var(--accent); border-color: var(--accent); }
.switch-row input:checked::after { transform: translateX(14px); }

.side-foot {
  display: flex; flex-direction: column; gap: 7px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.side-foot .btn { justify-content: flex-start; width: 100%; }

/* ---------------- 主区 ---------------- */
.main { min-width: 0; }

.main-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.summary {
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.summary b { color: var(--text); font-weight: 600; font-size: 15px; font-family: var(--font-serif); }
.summary span.sep { margin: 0 9px; opacity: .45; }

.sort-wrap { display: flex; align-items: center; gap: 8px; }
.sort-wrap .select { width: auto; min-width: 140px; }
.only-mobile { display: none; }

/* ---------------- 卡片网格 ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 20px 18px;
}

.card {
  position: relative;
  display: flex; flex-direction: column;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: transform .26s var(--ease), box-shadow .26s var(--ease), border-color .2s;
  box-shadow: var(--shadow-1);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2);
  border-color: var(--accent-line);
}

.card-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--cover-bg);
  overflow: hidden;
}
.card-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s var(--ease), filter .3s;
}
.card:hover .card-cover img { transform: scale(1.045); }

.cover-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 14px;
  text-align: center;
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--accent) 14%, var(--cover-bg)), var(--cover-bg));
  color: color-mix(in srgb, var(--accent) 65%, var(--text));
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: .04em;
  overflow: hidden;
}
.cover-fallback::before {
  content: "";
  position: absolute;
  width: 150%; height: 150%;
  top: -30%; left: -25%;
  background: radial-gradient(circle at 40% 30%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%);
}

.score-badge {
  position: absolute; right: 8px; bottom: 8px;
  display: flex; align-items: baseline; gap: 1px;
  padding: 3px 8px 4px;
  border-radius: 8px;
  background: rgba(20, 10, 16, .74);
  backdrop-filter: blur(8px);
  color: #fff;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 10px rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.14);
}
.score-badge.is-unrated {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 500;
  padding: 4px 8px;
  color: rgba(255,255,255,.72);
  background: rgba(20, 10, 16, .5);
}

.fav-tag {
  position: absolute; left: 8px; top: 8px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.fav-tag .ico { width: 13px; height: 13px; fill: currentColor; stroke: none; }

.status-strip {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  opacity: 0;
}
.card:hover .status-strip { opacity: 1; }

.card-body { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 3px; }

.card-title {
  font-family: var(--font-serif);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: .01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.card-meta {
  font-size: 11px;
  color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta .dot-sep { opacity: .5; }

.card-status {
  display: flex; align-items: center; width: 100%;
  font-size: 10.5px;
  color: var(--text-3);
}
.card-year {
  padding-left: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  opacity: .85;
}

/* ---------------- 空状态 ---------------- */
.empty {
  padding: 70px 24px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-xl);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.empty-emoji { font-size: 40px; line-height: 1; margin-bottom: 14px; opacity: .9; }
.empty h2 {
  font-family: var(--font-serif);
  font-size: 19px; font-weight: 600; margin: 0 0 8px;
  letter-spacing: .03em;
}
.empty p { color: var(--text-3); margin: 0 auto 20px; max-width: 380px; font-size: 13px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------------- 统计 ---------------- */
.stats { display: flex; flex-direction: column; gap: 20px; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}
.kpi {
  padding: 16px 18px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute; right: -30px; top: -30px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: var(--accent-soft);
  opacity: .8;
}
.kpi-label { font-size: 11px; letter-spacing: .1em; color: var(--text-3); text-transform: uppercase; position: relative; }
.kpi-value {
  position: relative;
  font-family: var(--font-serif);
  font-size: 30px; font-weight: 700;
  line-height: 1.15;
  margin-top: 6px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.kpi-value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.kpi-sub { position: relative; font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.panel {
  padding: 20px 22px 22px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 18px;
}
.panel-head h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 15px; font-weight: 600;
  letter-spacing: .04em;
}
.panel-head span { font-size: 11.5px; color: var(--text-3); }

.two-col {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
}

/* 直方图 */
.histo {
  display: flex; align-items: flex-end; gap: 4px;
  height: 172px;
  padding-top: 18px;
  border-bottom: 1px solid var(--grid-line);
  position: relative;
}
.histo-bar-wrap {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  height: 100%;
  position: relative;
  cursor: default;
}
.histo-bar {
  width: 100%;
  max-width: 26px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  min-height: 2px;
  transition: filter .18s, transform .18s var(--ease);
  transform-origin: bottom;
}
.histo-bar-wrap:hover .histo-bar { filter: brightness(1.15); transform: scaleY(1.02); }
.histo-bar.is-zero { background: var(--surface-3); }
.histo-tip {
  position: absolute;
  bottom: 100%; margin-bottom: 6px;
  padding: 3px 8px;
  font-size: 11px;
  white-space: nowrap;
  background: var(--text);
  color: var(--bg);
  border-radius: 5px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .16s, transform .16s;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  z-index: 2;
}
.histo-bar-wrap:hover .histo-tip { opacity: 1; transform: translateY(0); }
.histo-axis {
  display: flex; gap: 4px;
  margin-top: 7px;
  font-size: 9.5px;
  color: var(--text-3);
}
.histo-axis span { flex: 1; text-align: center; font-variant-numeric: tabular-nums; }

/* 甜甜圈 */
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut {
  width: 132px; height: 132px;
  border-radius: 50%;
  position: relative;
  flex: none;
  box-shadow: inset 0 0 0 1px var(--grid-line);
}
.donut::after {
  content: "";
  position: absolute; inset: 26px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--grid-line);
}
.donut-center {
  position: absolute; inset: 0;
  display: grid; place-content: center; text-align: center;
  z-index: 1;
}
.donut-center b {
  display: block;
  font-family: var(--font-serif);
  font-size: 24px; line-height: 1.05;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.donut-center small { font-size: 10px; color: var(--text-3); letter-spacing: .08em; }

.legend { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 120px; }
.legend-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  color: var(--text-2);
}
.legend-row .sw { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-row .n { margin-left: auto; color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 11.5px; }

/* 横条图 */
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar {
  display: grid;
  grid-template-columns: 92px 1fr 34px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.hbar-label {
  color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: right;
}
.hbar-track { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.hbar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width .5s var(--ease);
}
.hbar-n { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 11px; }

/* 标签偏好：同一行里同时看「玩得多」和「给分高」 */
.tbars { display: flex; flex-direction: column; gap: 10px; }
.tbar {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.tbar-label {
  color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: right;
}
.tbar-track { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.tbar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width .5s var(--ease);
}
.tbar-meta {
  color: var(--text-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 92px;
  text-align: right;
}
.tbar-meta b { color: var(--text); font-weight: 600; }

/* 统计页：面板头里的小分段开关 */
.stat-seg {
  display: flex; gap: 2px; padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  align-self: center;
}
.stat-seg button {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-3);
  transition: background .18s, color .18s;
}
.stat-seg button:hover { color: var(--text); }
.stat-seg button.is-on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-1); }
.stat-note { margin-top: 14px; font-size: 11px; color: var(--text-3); }

/* 年度柱：整条时间轴逐年铺开，窄屏横向滚动 */
.years-scroll { overflow-x: auto; overflow-y: hidden; padding-top: 16px; margin: 0 -2px; padding-left: 2px; padding-right: 2px; }
.years-scroll::-webkit-scrollbar { height: 4px; }
.years-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.years { display: flex; align-items: flex-end; gap: 4px; height: 150px; min-width: 100%; }
.year-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 5px; min-width: 0; }
.year-bar {
  width: 100%; max-width: 40px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 55%, var(--accent-2)), var(--accent));
  min-height: 3px;
  position: relative;
}
/* 该年一部都没有：留一根灰柱，时间轴不断档 */
.year-bar.is-zero { background: var(--surface-3); }
.year-bar.is-zero span { display: none; }
.year-bar span {
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.year-label { font-size: 10px; color: var(--text-3); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* ---------------- 弹层 ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 26px;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(18, 10, 16, .5);
  backdrop-filter: blur(6px);
  animation: fade .22s var(--ease);
}
[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, .62); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.modal-panel {
  position: relative;
  /* 所有面板（详情 / 角色 / 角色详情 / 关联 / 编辑）固定同一宽高，切换时不会忽大忽小 */
  width: min(920px, 100%);
  height: calc(100vh - 52px);
  max-height: calc(100vh - 52px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  animation: fade .2s var(--ease);
  scrollbar-width: thin;
}
.modal-panel::-webkit-scrollbar { width: 8px; }
.modal-panel::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

.modal-close {
  position: absolute; right: 14px; top: 14px; z-index: 3;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-2);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  transition: color .16s, background .16s;
}
.modal-close:hover { color: var(--accent); background: var(--accent-soft); }

/* 详情 */
.detail-hero {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 26px;
  padding: 26px 26px 20px;
}
.detail-cover {
  aspect-ratio: 3 / 4;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--cover-bg);
  box-shadow: var(--shadow-2);
  position: relative;
  border: 1px solid var(--border);
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.detail-info { min-width: 0; display: flex; flex-direction: column; }
.detail-title {
  font-family: var(--font-serif);
  font-size: 25px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 34px 4px 0;
  letter-spacing: .02em;
}
.detail-sub { font-size: 13px; color: var(--text-3); margin-bottom: 14px; }

.detail-score-row {
  display: flex; align-items: center; gap: 16px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 15px;
}
.big-score {
  font-family: var(--font-serif);
  font-size: 34px; font-weight: 700; line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.big-score.is-unrated { font-size: 14px; font-family: var(--font-sans); font-weight: 500; color: var(--text-3); }
.score-meta { display: flex; flex-direction: column; gap: 2px; }
.score-band { font-size: 12px; color: var(--text-2); font-weight: 500; }
.score-time { font-size: 11px; color: var(--text-3); }

.meta-list { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; }
.meta-row { display: flex; gap: 12px; }
.meta-row dt { width: 74px; flex: none; color: var(--text-3); white-space: nowrap; }
.meta-row dd { margin: 0; color: var(--text-2); min-width: 0; }

/* 详情里的人员名：看着像普通文字，悬停才显出可点 */
.staff-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted color-mix(in srgb, currentColor 35%, transparent);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.staff-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.staff-link:active { opacity: .7; }
.staff-sep { opacity: .45; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag {
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
}

/* ---- 剧透标签（VNDB 式） ---- */
/* 详情页标签行：标签在左，小眼睛在右 */
/* 详情页标签块：标题行（标签 + 小眼睛）+ 下方标签列表 */
.tag-block { margin-top: 14px; }
.tag-block .tag-list { margin-top: 0; }
.tag-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.tag-head-label { color: var(--text-3); font-size: 12.5px; line-height: 1; }
.tag-row { display: flex; align-items: flex-start; gap: 8px; }
.tag-row .tag-list { flex: 1; }
/* 剧透标签本体：醒目一点，提醒这是被揭底的 */
.tag.tag-spo {
  background: transparent;
  color: #c2557a;
  border: 1px dashed #d891ac;
}

/* ---- 编辑表单里的标签块：点一下切换「隐藏（剧透）」 ---- */
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.tag-chips:empty::before {
  content: '在上面填了标签，这里点一下就能设为隐藏';
  font-size: 11.5px;
  color: var(--text-3);
}
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: inherit; font-size: 11.5px; line-height: 1.7;
  padding: 2px 9px; border-radius: 999px; cursor: pointer;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-line);
  transition: color .16s, border-color .16s, background .16s;
}
.tag-chip .ico { width: 11px; height: 11px; }
.tag-chip:hover { border-color: var(--accent); }
.tag-chip.is-spo {
  background: transparent;
  color: #c2557a;
  border: 1px dashed #d891ac;
}
.tag-chip.is-spo:hover { background: color-mix(in srgb, #d891ac 12%, transparent); border-color: #c2557a; }
.field-hint { font-size: 11.5px; color: var(--text-3); line-height: 1.6; margin-top: 1px; }
.spoiler-eye, .spoiler-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
  width: 20px; height: 17px; padding: 0;
  font-family: inherit; line-height: 1;
  color: var(--text-3);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  cursor: pointer;
  transition: color .16s, border-color .16s, background .16s;
}
.spoiler-toggle { margin-left: 6px; }
/* 侧栏「标签」标题：让眼睛与文字垂直居中对齐（基线对齐会让方框整体偏高） */
.filter-block h3.h3-tool { display: flex; align-items: center; }
.filter-block h3.h3-tool .spoiler-toggle { margin-left: 6px; }
.spoiler-eye:hover, .spoiler-toggle:hover,
.spoiler-eye.is-on, .spoiler-toggle.is-on {
  color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft);
}
.spoiler-eye .ico, .spoiler-toggle .ico { width: 13px; height: 13px; }

/* 我的标签：虚线框区分，选中后变实线 */
.chips-grid .chip-mine { border-style: dashed; }
.chips-grid .chip-mine.is-on { border-style: solid; }

/* 两套筛选叠加时的小提示条（另一套里已勾的标签） */
.ns-note {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  margin-top: 7px; font-size: 11px; color: var(--text-3);
}
.ns-note[hidden] { display: none; }
.ns-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 5px 2px 8px;
  border-radius: 999px;
  font-family: inherit; font-size: 11px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
}
.ns-chip .ico { width: 9px; height: 9px; }
.ns-chip:hover { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }

/* 「资料库标签 / 我的标签」切换：眼睛左边的标签图标 */
.tag-ns {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  height: 17px; padding: 0 4px; margin-left: 6px;
  font-family: inherit; line-height: 1;
  color: var(--text-3); background: transparent;
  border: 1px solid var(--border-strong); border-radius: 4px;
  cursor: pointer;
  transition: color .16s, border-color .16s, background .16s;
}
.tag-ns .ico { width: 13px; height: 13px; }
.tag-ns:hover { color: var(--accent); border-color: var(--accent-line); }
.tag-ns.is-on { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.tag-ns .tag-ns-n { font-style: normal; font-size: 9.5px; font-variant-numeric: tabular-nums; }
.tag-ns .tag-ns-n[hidden] { display: none; }
/* 两只眼睛按状态二选一：默认闭眼（隐藏剧透），开启后睁眼 */
.spoiler-eye .ico:nth-child(2), .spoiler-toggle .ico:nth-child(2) { display: none; }
.spoiler-eye.is-on .ico:nth-child(1), .spoiler-toggle.is-on .ico:nth-child(1) { display: none; }
.spoiler-eye.is-on .ico:nth-child(2), .spoiler-toggle.is-on .ico:nth-child(2) { display: block; }

.detail-body { padding: 0 26px 12px; }

.section-label {
  font-size: 10.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}

/* 简介翻译开关：紧贴小节标题右侧的小「译」字 */
.tr-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 17px;
  margin-left: 7px; padding: 0 5px;
  font-family: inherit; font-size: 10.5px; letter-spacing: 0; line-height: 1;
  color: var(--text-3);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  cursor: pointer;
  vertical-align: 1px;
  transition: color .16s, border-color .16s, background .16s;
}
.tr-btn:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.tr-btn.is-on { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.tr-block.is-zh .tr-text { color: var(--text); }

.summary-text {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--text-3);
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 6px;
}

.review-box {
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-line);
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-serif);
  letter-spacing: .01em;
}
.review-box.is-empty { color: var(--text-3); font-family: var(--font-sans); font-size: 13px; font-style: normal; }

.detail-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 26px 22px;
  flex-wrap: wrap;
}
.detail-actions .spacer { margin-right: auto; }

/* ---------------- 角色 / 关联作品面板（点按钮后整页切换） ---------------- */

.cast-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 64px 14px 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.cast-head-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.cast-head-title { min-width: 0; }
.cast-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
}
.cast-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cast-head-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-3);
  flex: none;
  font-variant-numeric: tabular-nums;
}
.cast-dot { opacity: .5; }

/* 面板固定高度，内容少时让主体撑满并在其中垂直居中，避免底部一大片空白 */
.cast-view {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  box-sizing: border-box;
  padding-bottom: 24px;
}
.cast-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 26px 0;
}

/* 空态：内容居中，不要贴着顶部留一大片空白 */
.panel-empty {
  flex: 1;
  min-height: min(400px, calc(100vh - 320px));
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
  color: var(--text-3);
  padding: 0 20px;
}
.panel-empty .ico { width: 30px; height: 30px; opacity: .3; }
.panel-empty-title { margin: 0; font-size: 13.5px; color: var(--text-2); }
.panel-empty-hint {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.85;
  max-width: 340px;
  opacity: .8;
}

@media (max-width: 760px) {
  .cast-head { padding-right: 56px; }
  .cast-head-meta { display: none; }
}

.dp {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 13px 14px 15px;
  min-width: 0;
  transition: box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.dp.is-flash {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.dp-head {
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 11px;
}
.dp-title {
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-3);
}
.dp-count {
  font-size: 10px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.dp-spacer { margin-left: auto; }
.dp-src {
  font-size: 10px;
  color: var(--text-3);
  opacity: .75;
  border-bottom: 1px dotted color-mix(in srgb, currentColor 40%, transparent);
  cursor: help;
}
.dp-empty {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.8;
  padding: 4px 0 2px;
}
.dp-hint { display: block; font-size: 11px; opacity: .7; }

/* 角色图平铺 */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 18px 12px;
  padding-right: 4px;
  align-content: start;
}

.char-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  background: none;
  border: 0;
  text-align: left;
  min-width: 0;
  cursor: pointer;
}
.char-pic {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  background: var(--cover-bg);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s;
}
.char-pic img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.char-initial {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--text-3);
  opacity: .6;
}
.char-card:hover .char-pic {
  transform: translateY(-2px);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-1);
}
.char-card:hover .char-name { color: var(--accent); }
.char-name {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .15s;
}
.char-cv {
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 关联作品 */
/* 关联作品面板 */
.rel-group { margin-bottom: 22px; }
.rel-group:last-child { margin-bottom: 0; }
.rel-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.rel-group-name {
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--text-3);
}
.rel-group-spacer { margin-left: auto; }
.rel-group-meta {
  font-size: 10.5px;
  color: var(--text-3);
  opacity: .8;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 面板页脚：贴底，让条目少的面板不至于像没加载完 */
.cast-foot {
  margin-top: auto;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 10.5px;
  line-height: 1.8;
  color: var(--text-3);
}
.cast-foot > span { opacity: .78; min-width: 0; }
.cast-foot .btn { flex: none; opacity: 1; }

.rel-edit-sec { margin-bottom: 20px; }
.rel-edit-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--text-3);
  margin-bottom: 10px;
}
.rel-edit-count {
  font-size: 10px;
  line-height: 1;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.rel-edit-empty {
  font-size: 12px;
  color: var(--text-3);
  padding: 10px 0;
}

.rel-cur-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rel-cur {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-width: 0;
}
.rel-cur.is-muted { opacity: .7; }
.rel-cur-pic {
  width: 30px; height: 40px;
  flex: none;
  border-radius: 4px;
  overflow: hidden;
  background: var(--cover-bg);
  border: 1px solid var(--border);
}
.rel-cur-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rel-cur-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rel-cur-title {
  font-size: 12.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rel-cur-meta { font-size: 10.5px; color: var(--text-3); }
.rel-cur-del {
  flex: none;
  font-size: 11.5px;
  color: var(--text-3);
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 11px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.rel-cur-del:hover { color: #c0392b; border-color: #c0392b55; background: #c0392b12; }

.rel-add-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.rel-add-bar .input { flex: 1; }
.rel-add-bar .select { width: 118px; flex: none; }

.rel-cand-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.rel-cand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  min-width: 0;
}
.rel-cand:hover { background: var(--surface-2); }
.rel-cand-pic {
  width: 26px; height: 35px;
  flex: none;
  border-radius: 3px;
  overflow: hidden;
  background: var(--cover-bg);
  border: 1px solid var(--border);
}
.rel-cand-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rel-cand-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rel-cand-title {
  font-size: 12.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rel-cand-meta {
  font-size: 10.5px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rel-cand-add {
  flex: none;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.rel-cand-add:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.rel-cand-empty { font-size: 12px; color: var(--text-3); padding: 12px 2px; }
.rel-group-count {
  font-size: 10px;
  line-height: 1;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.rel-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(264px, 1fr));
  gap: 12px;
}
.rel-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  min-height: 104px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-align: left;
  cursor: pointer;
  min-width: 0;
  transition: border-color .15s, background .15s, transform .15s;
}
.rel-card:hover { border-color: var(--accent-line); background: var(--surface-3); }
.rel-card.is-missing { cursor: default; opacity: .6; }
.rel-card-cover {
  position: relative;
  width: 58px;
  height: 78px;
  flex: none;
  border-radius: 6px;
  overflow: hidden;
  background: var(--cover-bg);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
}
.rel-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rel-card-cover .cover-fallback { font-size: 9px; padding: 3px; }
.rel-card-initial {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--text-3);
}
.rel-card-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.rel-card-title {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rel-card:hover .rel-card-title { color: var(--accent); }
.rel-card-alt {
  font-size: 10.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rel-card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; row-gap: 3px; }
.rel-card-date { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.rel-card-type {
  font-size: 9.5px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-3);
  white-space: nowrap;
  flex: 0 0 auto;
}
/* 补充维度（同音乐 / 同编剧…）：同一部作品只出一张卡，其余关系降级成这枚小标签 */
.rel-card-type.is-extra {
  background: transparent;
  border: 1px solid var(--line, var(--border, #3a3140));
  color: var(--text-3);
  opacity: .8;
}
.rel-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 1px; }
.tag-mini {
  font-size: 9.5px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--surface-3);
  color: var(--text-3);
  border: 0;
}
.rel-card-grade {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  flex: none;
  padding-right: 2px;
}
.rel-more {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-3);
  background: none;
  border: 0;
  padding: 2px 0;
  cursor: pointer;
  border-bottom: 1px dotted color-mix(in srgb, currentColor 45%, transparent);
}
.rel-more:hover { color: var(--accent); }

/* ---------------- 角色详情 ---------------- */
.char-detail { padding: 26px 26px 24px; }
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px;
  color: var(--text-3);
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}
.back-link:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

.char-detail .back-link { margin-bottom: 16px; }

.char-detail-hero {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  gap: 24px;
}
@media (max-width: 620px) {
  .char-detail-hero { grid-template-columns: 1fr; gap: 18px; }
  .char-detail-pic { max-width: 200px; }
}

/* 手机：角色面板列数由 JS 内联指定，这里强制改回自适应，避免一行挤 8 个小图 */
@media (max-width: 700px) {
  html, body { overflow-x: clip; }
  /* 顶栏两行：第一行 logo+搜索框，第二行按钮 */
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 12px; row-gap: 8px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .search-wrap { order: 1; flex: 1 1 calc(100% - 52px); min-width: 0; }
  .search-wrap input { min-width: 0; }
  .topbar-actions { order: 2; width: 100%; margin-left: 0; gap: 6px; flex: none; justify-content: space-between; }
  .btn-ghost { padding: 8px 10px; }
  .char-grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)) !important;
    gap: 16px 10px;
  }
  .char-name { font-size: 12.5px; }
  .char-cv { font-size: 11px; }
  .cast-body { padding: 16px 14px 22px; }
  .char-detail { padding: 18px 16px 20px; }
  /* 手机上 ✕ 太小难点：加大热区并垫底色，避免与封面图混在一起 */
  .modal-close {
    right: 10px; top: 10px;
    padding: 9px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-1);
    backdrop-filter: blur(6px);
  }
}
.char-detail-pic .char-pic {
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
}
.char-detail-info { min-width: 0; }
.char-detail-name {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 30px 8px 0;
}
.char-detail-sub { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.char-role-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
}
.char-works-count { font-size: 11.5px; color: var(--text-3); }
.char-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.char-section { margin-top: 24px; }
.char-summary {
  margin: 0;
  font-size: 13px;
  line-height: 1.95;
  color: var(--text-2);
  white-space: pre-wrap;
}

.char-works {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 8px;
}
.char-work {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.char-work:hover { border-color: var(--accent-line); background: var(--surface-3); }
.char-work-pic {
  width: 38px; height: 51px;
  flex: none;
  border-radius: 4px;
  overflow: hidden;
  background: var(--cover-bg);
  border: 1px solid var(--border);
}
.char-work-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.char-work-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.char-work-title {
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.char-work-meta { display: flex; align-items: center; gap: 6px; }
.char-work-role {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
}
.char-work-date { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
/* 分篇换声优：这一部用的 CV 跟在日期后面 */
.char-work-cv {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  white-space: nowrap;
}
.meta-note { color: var(--text-3); font-size: 11.5px; }
.meta-note .staff-link { color: var(--text-2); }
.char-work-grade {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  flex: none;
}

/* 同一声优的其他角色 */
.char-cv-count { font-size: 11.5px; color: var(--text-3); font-weight: 400; margin-left: 6px; }
.char-cv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 8px;
}
.char-cv {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.char-cv:hover { border-color: var(--accent-line); background: var(--surface-3); }
.char-cv:active { transform: scale(.985); }
.char-cv-pic {
  width: 36px; height: 46px;
  flex: none;
  border-radius: 4px;
  overflow: hidden;
  background: var(--cover-bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.char-cv-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.char-cv-initial { font-size: 15px; color: var(--text-3); font-family: var(--font-serif); }
.char-cv-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.char-cv-name {
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.char-cv:hover .char-cv-name { color: var(--accent); }
.char-cv-meta {
  font-size: 10.5px;
  color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 编辑表单 */
.form-head {
  padding: 22px 64px 16px 26px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 2;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.form-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 17px; font-weight: 600; letter-spacing: .04em;
}

.bgm-search-bar {
  display: flex; gap: 8px;
  padding: 16px 26px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.bgm-search-bar input { flex: 1; }
.bgm-results {
  padding: 6px 26px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  max-height: 260px;
  overflow-y: auto;
}
.bgm-result {
  display: flex; gap: 11px; align-items: center;
  padding: 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .15s;
}
.bgm-result:hover { background: var(--surface); }
.bgm-result img {
  width: 38px; height: 52px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--cover-bg);
  flex: none;
}
.bgm-result .bi { min-width: 0; flex: 1; }
.bgm-result .bt {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bgm-result .bs { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bgm-result .bn {
  font-family: var(--font-serif);
  font-size: 14px; color: var(--accent);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.bgm-hint { font-size: 12px; color: var(--text-3); padding: 10px 4px; }

.form-body {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 26px;
  padding: 22px 26px 8px;
}

.cover-col { display: flex; flex-direction: column; gap: 10px; }
.cover-preview {
  aspect-ratio: 3 / 4;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--cover-bg);
  border: 1px dashed var(--border-strong);
  position: relative;
  display: grid; place-items: center;
  color: var(--text-3);
  font-size: 12px;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-preview .cover-fallback { font-size: 12px; }
.cover-col .field { margin: 0; }

/* 封面：粘贴 / 拖拽截图的小框 */
.cover-paste {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 8px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-3);
  font-size: 11px; line-height: 1.55;
  transition: border-color .15s ease, background .15s ease;
}
.cover-paste.is-over { border-color: var(--accent-2); background: var(--accent-soft); }
.cover-paste.has-img { border-style: solid; }
.cover-paste .cp-img {
  width: 30px; height: 40px; flex: none;
  object-fit: cover; border-radius: 4px;
  background: var(--surface-2); display: block;
}
.cover-paste .cp-img[hidden] { display: none; }
.cover-paste .cp-txt { flex: 1; min-width: 0; }
.cover-paste .cp-txt b { color: var(--text); font-weight: 600; }
.cover-paste kbd {
  font: inherit; font-size: 10px; padding: 0 4px;
  border: 1px solid var(--border-strong); border-radius: 4px;
  background: var(--surface-2); color: var(--text-2);
  white-space: nowrap;
}
.cover-paste .cp-clear { flex: none; padding: 2px 7px; font-size: 10.5px; border-radius: 99px; }
.cover-paste .cp-clear[hidden] { display: none; }

/* 封面列里的「简介」小框：固定一行高，粘贴长文也不撑开布局，框内滚动 */
.summary-quick {
  min-height: 0;
  height: 34px;
  padding: 7px 10px;
  line-height: 18px;
  font-size: 12.5px;
  font-family: inherit;
  resize: none;
  overflow-y: auto;
}
.summary-len {
  margin-left: auto;
  font-weight: 400;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.fields { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label {
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: .04em;
  display: flex; align-items: center; gap: 6px;
}
.field > label .req { color: var(--accent); }

.input, .textarea {
  width: 100%;
  padding: 8px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color .16s, background .16s, box-shadow .16s;
  font-size: 13px;
}
.input:focus, .textarea:focus {
  border-color: var(--accent-line);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}
.textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.75;
  font-family: var(--font-serif);
  font-size: 13.5px;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: .75; }

/* 评分控件 */
.rating-box {
  padding: 13px 15px 15px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.rating-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.rating-num {
  font-family: var(--font-serif);
  font-size: 22px; font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.rating-num small { font-size: 11px; color: var(--text-3); font-weight: 400; margin-left: 2px; }
.rating-band {
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--p, 50%), var(--surface-3) var(--p, 50%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px; height: 17px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--accent);
  box-shadow: 0 1px 5px rgba(0,0,0,.22);
  transition: transform .14s;
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--surface-3); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--accent); }
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--accent);
}

.rating-scale {
  display: flex; justify-content: space-between;
  font-size: 9.5px; color: var(--text-3);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.form-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 26px 22px;
  border-top: 1px solid var(--border);
  position: sticky; bottom: 0;
  background: var(--surface);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}
.form-foot .spacer { margin-right: auto; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 34px;
  transform: translate(-50%, 20px);
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s var(--ease), transform .24s var(--ease);
  z-index: 200;
  max-width: 80vw;
  text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: #a83050; color: #fff; }

/* spinner */
.spin {
  width: 14px; height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: rot .7s linear infinite;
  display: inline-block;
  vertical-align: -2px;
}
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------------- 响应式 ---------------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; gap: 0; padding: 18px 18px 60px; }
  /* 手机上抽屉从顶栏下方开始，避免顶部内容被顶栏盖住、滚不回去 */
  .sidebar {
    position: fixed; left: 0; top: var(--tb-h, 0px); bottom: 0;
    width: min(286px, 86vw); max-height: none;
    z-index: 60;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 0 16px 26px;
    transform: translateX(-102%);
    transition: transform .28s var(--ease);
    box-shadow: var(--shadow-3);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.is-open { transform: none; }
  /* 抽屉头吸顶，任何时候都能一眼看到「清空 / 关闭」 */
  .sidebar .side-head {
    position: sticky; top: 0; z-index: 2;
    margin: 0 -16px 2px; padding: 13px 16px 10px;
    background: var(--surface);
    gap: 8px;
    justify-content: flex-start;
  }
  .sidebar .side-head .text-btn { margin-left: auto; }
  .sidebar > .filter-block:first-of-type { padding-top: 12px; }
  /* 手机上一屏只有一个滚动条：标签不再内部滚动，免得手势被吃掉、滚不回顶 */
  .sidebar .chips-scroll { max-height: none; overflow: visible; padding-right: 0; }
  .side-close {
    width: 26px; height: 26px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; color: var(--text-2);
    background: var(--surface-2); border: 1px solid var(--border);
  }
  .side-close .ico { width: 13px; height: 13px; }
  html.filter-open, html.filter-open body { overflow: hidden; }
  .only-mobile { display: inline-flex; }
  .two-col { grid-template-columns: 1fr; }
  .detail-hero { grid-template-columns: 150px minmax(0, 1fr); gap: 18px; padding: 20px 18px 14px; }
  .form-body { grid-template-columns: 1fr; gap: 18px; padding: 18px; }
  .cover-col { flex-direction: row; align-items: flex-start; gap: 14px; }
  .cover-preview { width: 120px; flex: none; }
  .detail-title { font-size: 20px; }
  .brand-text { display: none; }
}

@media (max-width: 700px) {
  .topbar { padding: 10px 14px; gap: 10px; }
  .topbar-actions { gap: 6px; }
  .seg-btn span { display: none; }
  .seg-btn { padding: 6px 9px; }
  .search-wrap kbd { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 14px 12px; }
  .btn-primary span { display: none; }
  .btn-primary { padding: 8px 11px; }
  .modal { padding: 0; }
  .modal-panel { height: 100vh; max-height: 100vh; border-radius: 0; width: 100%; }
  .detail-hero { grid-template-columns: 1fr; }
  .detail-cover { width: 150px; }
  .field-row { grid-template-columns: 1fr; }
  .kpi-value { font-size: 24px; }
  .tbar { grid-template-columns: 72px 1fr auto; gap: 8px; }
  .tbar-meta { min-width: 76px; font-size: 10.5px; }
  /* 31 年铺不进 390px，改成可横向滑动的长条 */
  .years { min-width: 760px; gap: 3px; }
  .year-label { font-size: 9.5px; }
}

/* ============================================================
   分享版（只读静态站点）—— 由 tools/build-share.js 注入 window.YV_SHARE
   ============================================================ */
.share-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px; letter-spacing: .02em;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color .18s, background .18s, border-color .18s;
}
.share-badge:hover { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.share-badge .sb-ver { font-variant-numeric: tabular-nums; }

/* 有新版本：顶栏下面一条，不遮挡内容，会随页面滚走 */
.update-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 26px;
  font-size: 13px; line-height: 1.5;
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  border-bottom: 1px solid var(--accent-line);
}
.update-bar > .ico { color: var(--accent); flex: none; }
.update-bar .ub-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.update-bar .ub-text b { font-weight: 600; color: var(--accent); }
.update-bar .spacer { flex: 1 1 auto; }

/* 版本信息面板 */
.about-body { padding: 6px 26px 26px; }
.about-body .section-label { margin-top: 22px; }
.about-rows { margin: 16px 0 4px; display: flex; flex-direction: column; gap: 2px; }
.about-rows > div {
  display: grid; grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px; padding: 7px 0;
  border-bottom: 1px dashed var(--border);
}
.about-rows dt { color: var(--text-3); font-size: 12.5px; }
.about-rows dd { margin: 0; font-size: 13px; color: var(--text); word-break: break-all; }
.about-notes { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--text-2); line-height: 1.75; }
.about-tip { margin: 6px 0 0; font-size: 12.5px; color: var(--text-3); line-height: 1.75; }
.about-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.about-upd { margin-top: 12px; font-size: 12.5px; color: var(--text-2); }
.about-upd-new { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; }
.about-upd-new b { color: var(--accent); }
.about-upd-ok { margin: 0; color: var(--ok); }
.personal-editor {
  padding: 20px 26px 6px;
  display: flex; flex-direction: column; gap: 14px;
}
.pe-work { font-family: var(--font-serif); font-size: 16px; font-weight: 600; letter-spacing: .02em; }
.pe-tip { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.65; }
.share-note {
  margin-left: 8px;
  font-size: 11px; font-weight: 400; color: var(--text-3); letter-spacing: 0;
}
@media (max-width: 700px) {
  .share-badge { height: 24px; padding: 0 8px; font-size: 11px; }
  .share-badge .sb-ver { display: none; }
  .update-bar { padding: 8px 14px; font-size: 12.5px; flex-wrap: wrap; }
  .update-bar .ub-text { white-space: normal; }
  .personal-editor { padding: 16px 18px 6px; }
  .about-body { padding: 6px 18px 22px; }
  .about-rows > div { grid-template-columns: 76px minmax(0, 1fr); }
}

/* ============================================================
   收藏 / 喜欢
   ============================================================ */
/* 五种收藏状态各自的主色，卡片角标 / 详情按钮 / 状态选择器共用 */
.st-wish    { --st: var(--accent); }
.st-playing { --st: var(--info); }
.st-done    { --st: var(--ok); }
.st-hold    { --st: var(--warn); }
.st-dropped { --st: var(--muted-badge); }

/* 顶栏的星星 / 爱心：激活时填色，与展厅 / 统计的分段按钮区分开 */
#btn-collection.is-active .ico,
#btn-likes.is-active .ico { fill: color-mix(in srgb, currentColor 22%, transparent); }

/* 卡片：喜欢的小爱心在右上角（评分角标在右下角），状态写在年份那一行 */
.fav-tag { left: auto; right: 8px; top: 8px; }
.card-status { justify-content: space-between; gap: 6px; }
.card-st {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--st);
  background: color-mix(in srgb, var(--st) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--st) 26%, transparent);
  white-space: nowrap;
}

/* 收藏 / 喜欢视图的顶部条 */
.viewbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}
.vb-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vb-title {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-serif);
  font-size: 14px; font-weight: 600; letter-spacing: .05em;
}
.vb-title .ico { width: 15px; height: 15px; color: var(--accent); }
.vb-note { font-size: 11.5px; color: var(--text-3); }
.vb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.vb-chip .ico { width: 12px; height: 12px; }
.vb-chip.is-on .ico { stroke-width: 2.1; }

/* 详情页评分行右侧的「喜欢 / 收藏」 */
.score-acts { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.stat-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  transition: color .16s, border-color .16s, background .16s;
}
.stat-toggle .ico { width: 14px; height: 14px; }
.stat-toggle:hover { color: var(--accent); border-color: var(--accent-line); }
.stat-toggle.like.is-on {
  color: #d8396d;
  border-color: color-mix(in srgb, #d8396d 34%, transparent);
  background: color-mix(in srgb, #d8396d 11%, transparent);
}
.stat-toggle.like.is-on .ico { fill: currentColor; }
.stat-toggle.collect {
  color: var(--st);
  border-color: color-mix(in srgb, var(--st) 30%, transparent);
  background: color-mix(in srgb, var(--st) 10%, transparent);
}

/* 收藏面板 */
.collect-panel { padding: 18px 26px 4px; display: flex; flex-direction: column; }
.cp-work {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 16px; margin-bottom: 16px;
  border-bottom: 1px dashed var(--border);
}
.cp-cover {
  width: 52px; height: 69px; flex: none;
  border-radius: 8px; overflow: hidden;
  background: var(--cover-bg);
  box-shadow: var(--shadow-1);
}
.cp-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cp-meta { min-width: 0; }
.cp-title { font-family: var(--font-serif); font-size: 15.5px; font-weight: 600; line-height: 1.35; }
.cp-sub { margin-top: 3px; font-size: 11.5px; color: var(--text-3); }

.status-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.status-opt {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  padding: 11px 4px 9px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 12px;
  transition: color .16s, border-color .16s, background .16s, transform .12s;
}
.status-opt .ico { width: 18px; height: 18px; }
.status-opt:hover { color: var(--st); border-color: color-mix(in srgb, var(--st) 32%, transparent); transform: translateY(-1px); }
.status-opt.is-on {
  color: var(--st);
  border-color: color-mix(in srgb, var(--st) 46%, transparent);
  background: color-mix(in srgb, var(--st) 13%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--st) 10%, transparent);
}
/* 五角星和播放三角是实心图标，描边版在大尺寸下太空 */
.status-opt.st-wish .ico,
.status-opt.st-playing .ico { fill: color-mix(in srgb, currentColor 18%, transparent); }

.like-toggle {
  margin-top: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  transition: color .16s, border-color .16s, background .16s;
}
.like-toggle .ico { width: 17px; height: 17px; }
.like-toggle:hover { color: #d8396d; border-color: color-mix(in srgb, #d8396d 34%, transparent); }
.like-toggle.is-on {
  color: #d8396d;
  border-color: color-mix(in srgb, #d8396d 40%, transparent);
  background: color-mix(in srgb, #d8396d 10%, var(--surface));
}
.like-toggle.is-on .ico { fill: currentColor; }

/* 统计页口径说明 */
.stats-note {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 14px;
  margin-bottom: 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  font-size: 12px;
  color: var(--text-2);
}
.stats-note .ico { width: 14px; height: 14px; color: var(--accent); }
.stats-note b { color: var(--accent); font-weight: 600; }

@media (max-width: 700px) {
  .viewbar { padding: 10px 12px; gap: 8px; }
  .vb-chips { margin-left: 0; width: 100%; }
  .vb-chip { padding: 4px 9px; }
  .detail-score-row { flex-wrap: wrap; row-gap: 10px; }
  .score-acts { margin-left: 0; width: 100%; justify-content: flex-end; }
  .collect-panel { padding: 16px 18px 2px; }
  .status-picker { gap: 5px; }
  .status-opt { padding: 9px 2px 7px; font-size: 11px; gap: 4px; }
  .status-opt .ico { width: 16px; height: 16px; }
}

/* ============================================================
   汉化标签 / 我的标签
   ============================================================ */
.tag.tag-cn {
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 36%, transparent);
  font-weight: 600;
}

.mytag-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 8px;
}
.mytag-label { font-size: 11.5px; color: var(--text-3); }
.mytag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px;
  padding: 2px 4px 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  color: var(--text-2);
}
.mytag button {
  width: 15px; height: 15px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-3);
  line-height: 1;
}
.mytag button:hover { background: var(--surface-3); color: var(--danger, #c0392b); }
.mytag button .ico { width: 11px; height: 11px; }

/* 标签编辑器（收藏面板里） */
.tag-editor { margin-top: 6px; }
.tag-editor-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag-editor-empty { font-size: 12px; color: var(--text-3); }
.tag-editor-input {
  display: flex; align-items: center; gap: 8px;
}
.tag-editor-input input {
  flex: 1; min-width: 0;
  padding: 8px 11px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}
.tag-editor-input input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.tag-sugg-hint { font-size: 11px; color: var(--text-3); margin-top: 10px; }
.tag-sugg-hint[hidden] { display: none; }
.tag-sugg { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag-sugg .chip {
  font-size: 11.5px; padding: 3px 8px;
  border-radius: 999px;
  border: 1px dashed var(--border-strong);
  background: transparent; color: var(--text-3);
}
.tag-sugg .chip:hover { color: var(--accent); border-color: var(--accent-line); }

/* ============================================================
   设置面板
   ============================================================ */
.settings-panel { padding: 4px 22px 22px; }
.set-group { border-top: 1px solid var(--border); padding: 16px 0 4px; }
.set-group:first-child { border-top: none; padding-top: 0; }
.set-group-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); font-weight: 600;
  margin-bottom: 12px;
}
.set-group-label .ico { width: 14px; height: 14px; }

.set-row {
  display: flex; align-items: center; gap: 14px;
  padding: 7px 0 13px;
}
.set-row-top { align-items: flex-start; }
.set-name { flex: 1; min-width: 0; }
.set-name b { display: block; font-size: 13.5px; font-weight: 500; color: var(--text); }
.set-name small { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 2px; line-height: 1.5; }
.set-val { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 46px; text-align: right; }

.set-seg { padding: 2px; }
.set-seg .seg-btn { padding: 4px 10px; font-size: 12px; }

.set-range { width: 100%; display: flex; flex-direction: column; gap: 6px; }
input[type="range"].set-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 999px;
  background: linear-gradient(var(--accent), var(--accent)) 0/var(--p, 50%) 100% no-repeat, var(--surface-3);
  outline: none; cursor: pointer;
}
input[type="range"].set-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
  box-shadow: var(--shadow-1); cursor: pointer;
}
input[type="range"].set-slider::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); cursor: pointer;
}

.set-bg-thumb {
  width: 78px; height: 50px; flex: none;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2) center/cover no-repeat;
  display: grid; place-items: center;
  color: var(--text-3); font-size: 11px;
}
.set-actions { display: flex; gap: 7px; flex-wrap: wrap; }
/* 站点图标缩略图是正方形 */
.set-bg-thumb.set-logo-thumb { width: 52px; height: 52px; border-radius: 13px; font-size: 10.5px; }

/* 开关 */
.switch {
  position: relative; flex: none;
  width: 44px; height: 25px; border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  transition: background .2s, border-color .2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform .2s var(--ease);
}
.switch.is-on { background: var(--accent); border-color: var(--accent); }
.switch.is-on::after { transform: translateX(19px); }

.set-foot {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 14px; margin-top: 6px;
}
.set-foot .text-btn { font-size: 12px; color: var(--text-3); }
.set-foot .text-btn:hover { color: #c0392b; }

@media (max-width: 700px) {
  .settings-panel { padding: 2px 16px 18px; }
  .set-row { gap: 10px; }
  .set-name small { display: none; }
}

/* 背景图开着时，弹层里的表单要保证能读：比卡片更实一点 */
html.has-bg .modal-panel,
html.has-bg .modal-card {
  background: color-mix(in srgb, var(--surface-solid) 95%, transparent);
  backdrop-filter: blur(22px) saturate(120%);
}

/* 手机上顶栏按钮太多（尤其分享版多一个版本徽标）时允许折行，避免整页横向溢出 */
@media (max-width: 700px) {
  .topbar { max-width: 100vw; overflow-x: hidden; }
  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    row-gap: 6px;
    max-width: 100%;
  }
  .topbar-actions .icon-btn { width: 31px; height: 31px; }
  .topbar-actions .icon-btn .ico { width: 16px; height: 16px; }
}

/* 手机上顶栏按钮太多（尤其分享版多一个版本徽标）时允许折行，避免整页横向溢出 */
@media (max-width: 700px) {
  .topbar { max-width: 100vw; overflow-x: hidden; }
  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    row-gap: 6px;
    max-width: 100%;
  }
  .topbar-actions .icon-btn { width: 31px; height: 31px; }
  .topbar-actions .icon-btn .ico { width: 16px; height: 16px; }
}

/* ============================================================
   喜欢视图：作品 / 角色 两个列表
   ============================================================ */
.vb-tabs {
  display: inline-flex; gap: 2px; padding: 2px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.vb-tab {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  font-family: inherit; font-size: 12.5px;
  color: var(--text-2);
  background: transparent;
  transition: color .15s, background .15s;
}
.vb-tab .ico { width: 13px; height: 13px; }
.vb-tab i {
  font-style: normal; font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}
.vb-tab:hover { color: var(--text); }
.vb-tab.is-on {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-1);
}
.vb-tab.is-on i { color: var(--accent); }

/* 角色列表沿用展厅网格，但列更密一些 */
.grid.is-chars {
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 20px 14px;
  align-items: start;
}

/* 角色卡右上角的心形 */
.char-card { position: relative; }
.char-like-dot {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(4px);
  color: var(--accent);
  box-shadow: var(--shadow-1);
  pointer-events: none;
}
.char-like-dot .ico { width: 12px; height: 12px; fill: currentColor; }
.char-card.is-liked .char-pic { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }

/* 角色页名字下面的喜欢按钮 */
.char-like-btn {
  display: inline-flex; align-items: center; gap: 5px;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-family: inherit; font-size: 12px; line-height: 1.5;
  transition: color .15s, border-color .15s, background .15s;
}
.char-like-btn .ico { width: 13px; height: 13px; }
.char-like-btn:hover { color: var(--accent); border-color: var(--accent-line); }
.char-like-btn.is-on {
  color: var(--accent);
  border-color: var(--accent-line);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.char-like-btn.is-on .ico { fill: currentColor; }

@media (max-width: 700px) {
  .vb-tabs { width: 100%; }
  .vb-tab { flex: 1; justify-content: center; }
  .grid.is-chars { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 16px 10px; }
}

/* ============================================================
   详情页：发布界面
   ============================================================ */
.store-block { margin-top: 14px; }
.store-head {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 8px;
}
.store-head-label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-3); font-weight: 600;
}
.store-head-note { font-size: 11px; color: var(--text-3); opacity: .8; }
.store-list { display: flex; flex-wrap: wrap; gap: 7px; }
.store-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12.5px;
  text-decoration: none;
  transition: border-color .15s, background .15s, color .15s, transform .15s;
}
.store-link .ico { width: 12px; height: 12px; color: var(--text-3); }
.store-name { font-weight: 600; }
.store-host {
  font-size: 11px; color: var(--text-3);
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.store-link:hover {
  border-color: var(--accent-line);
  background: var(--surface);
  color: var(--accent);
  transform: translateY(-1px);
}
.store-link:hover .ico { color: var(--accent); }

@media (max-width: 700px) {
  .store-host { display: none; }
  .store-link { padding: 5px 9px; font-size: 12px; }
}

/* ============================================================
   本地换封面 / 立绘
   ============================================================ */
.img-swap {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(6px);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  color: var(--text-2);
  opacity: 0;
  transition: opacity .15s, color .15s, border-color .15s, transform .15s;
  z-index: 3;
}
.img-swap .ico { width: 14px; height: 14px; }
.img-swap:hover { color: var(--accent); border-color: var(--accent-line); transform: translateY(-1px); }
.img-swap.is-clear { top: 8px; right: 44px; }
.img-swap.is-clear:hover { color: #c0392b; border-color: #c0392b; }
.detail-cover:hover .img-swap,
.char-detail-pic:hover .img-swap { opacity: 1; }
/* 已经把图换过的时候，还原键一直露着，免得忘了自己在看本地图 */
.img-swap.is-clear { opacity: 1; }

.char-detail-pic { position: relative; }

@media (hover: none) {
  .img-swap { opacity: .85; }
}
