:root {
  color-scheme: light;
  --bg: #edf0f6;
  --panel: #ffffff;
  --panel-2: #eef0fb;
  --text: #1a1d26;
  --muted: #6b7280;
  --line: #dce0ea;
  --line-soft: #eaedf4;
  --accent: #4f46b8;
  --accent-strong: #3b3496;
  --blue: #2563eb;
  --green: #157f5c;
  --amber: #b06a00;
  --red: #c03545;
  --shadow: 0 1px 2px rgba(26, 32, 52, 0.04), 0 8px 24px rgba(26, 32, 52, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button, input, select, textarea { font: inherit; }

button, .file-btn {
  border: 1px solid #ccd2e0;
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}

button:hover, .file-btn:hover { background: var(--panel-2); border-color: var(--accent); }
button:active, .file-btn:active { transform: translateY(1px); }
button.ghost { background: transparent; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
button.danger { color: var(--red); border-color: #e6c2c8; }
button.danger:hover { background: #fdf3f4; border-color: var(--red); }
.file-btn input { display: none; }

/* ===== 外壳 ===== */

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
}

.side-nav {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-strong);
  color: #fff;
  font-weight: 800;
}

.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); margin-top: 2px; }

.side-nav nav { display: grid; gap: 8px; }

.nav-item {
  justify-content: flex-start;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.nav-item { position: relative; border-radius: 8px; }

.nav-item.active {
  background: var(--panel-2);
  border-color: #c6c8ee;
  color: var(--accent-strong);
}

/* 选中项左侧的重音条，比单纯换底色更明确 */
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.nav-note {
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.workspace { padding: 22px 24px 44px; overflow-x: hidden; }

.topbar {
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-title { min-width: 0; }

/* ===== 全局类型切换 =====
   片库 / 档次 / 年度 共用。做得比页内的小分段控件重一点：
   它管着整站看到的内容，不该和「封面墙 / 表格」那种局部开关长得一样。 */

.kind-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow);
  flex: none;
}

.kind-switch button {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  min-height: 36px;
  padding: 7px 16px;
}

.kind-switch button + button { border-left: 1px solid var(--line-soft); }
.kind-switch button:hover { background: var(--panel-2); }

.kind-switch button.active {
  background: var(--accent);
  color: #fff;
}

.kind-switch button.active:hover { background: var(--accent-strong); }

h1, h2 { margin: 0; }
h1 { font-size: 27px; color: var(--accent-strong); line-height: 1.2; }
h2 { font-size: 16px; color: var(--accent-strong); line-height: 1.3; }
p { margin: 6px 0 0; color: var(--muted); }

.hint { font-size: 13px; line-height: 1.7; margin: 0 0 12px; }
.hint strong { color: var(--text); }

.view { display: none; }
.view.active { display: grid; gap: 18px; }

/* ===== 面板 ===== */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--accent-strong);
  font-size: 13px;
  white-space: nowrap;
}

/* ===== 表单 ===== */

.quick-form {
  display: grid;
  grid-template-columns: minmax(200px, 2fr) 110px 130px 90px 160px auto;
  gap: 10px;
  align-items: end;
}

.quick-form label, .form-grid label, .full {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input, select, textarea {
  min-height: 38px;
  border: 1px solid #ccd2e0;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  width: 100%;
}

textarea { min-height: 72px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c6c8ee; outline-offset: -1px; border-color: var(--accent); }
input:disabled { background: #f5f6f9; color: var(--muted); cursor: not-allowed; }

.quick-form button[type="submit"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 130px 130px 120px 150px;
  gap: 10px;
  margin: 12px 0 14px;
}

.data-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

.sync-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.sync-form label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.sync-form label small { color: var(--muted); font-size: 12px; }

.sync-auto {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.sync-auto input { width: 16px; height: 16px; min-height: 0; }

/* ===== 表格 ===== */

.table-wrap { width: 100%; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; min-width: 760px; }

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

th { color: var(--muted); font-size: 13px; font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
td strong { font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.table-actions { text-align: right; white-space: nowrap; }

.segmented-actions {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.segmented-actions button {
  border: 0;
  border-radius: 0;
  min-height: 30px;
  padding: 5px 10px;
  font-size: 13px;
}

.segmented-actions button + button { border-left: 1px solid var(--line); }

.status-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
  background: #f1f3f8;
  color: var(--muted);
}

.status-watching { background: #e7efff; color: var(--blue); }
.status-watched { background: #e5f5ee; color: var(--green); }
.status-dropped { background: #fbeaec; color: var(--red); }
.status-wish { background: #fdf1e0; color: var(--amber); }

.tag {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--accent-strong);
  font-size: 12px;
}

/* 类型徽章。三个类型用同一冷色族的三个色相，饱和度压得很低 ——
   它只是个限定词，不该跟状态标签和档次徽章抢注意力。 */

.kind-tag {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  background: #eef0f7;
  color: var(--muted);
}

.kind-movie { background: #eaeefb; color: #4453a8; }
.kind-tv { background: #e8f1f4; color: #2f6b7d; }
.kind-anime { background: #f5ecf6; color: #7a4b86; }

/* ===== 列表与条形 ===== */

.rows, .bar-list { display: grid; gap: 10px; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}

.row:last-child { border-bottom: 0; }
.row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.bar-item {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 50px;
  gap: 10px;
  align-items: center;
}

.bar-track { height: 9px; background: #e9ecf4; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); }

.empty { color: var(--muted); padding: 12px 0; }

.status-line {
  color: var(--muted);
  padding: 10px 12px;
  border: 1px dashed #cbd2e0;
  border-radius: 6px;
  background: #f8f9fc;
  margin: 0;
}

.status-line.status-ok { color: var(--green); border-color: #bde0d0; background: #f2fbf7; }
.status-line.status-err { color: var(--red); border-color: #eec7cd; background: #fdf3f4; }

/* ===== 弹窗 ===== */

.edit-dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  width: min(760px, calc(100vw - 32px));
  box-shadow: 0 24px 60px rgba(20, 25, 45, 0.22);
}

.edit-dialog::backdrop { background: rgba(20, 25, 45, 0.4); }
.edit-dialog form { padding: 18px; display: grid; gap: 16px; }

.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.edit-dialog fieldset {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px;
  margin: 0;
  display: grid;
  gap: 12px;
}

.edit-dialog legend {
  padding: 0 6px;
  color: var(--accent-strong);
  font-weight: 600;
  font-size: 14px;
}

.edit-dialog legend small { color: var(--muted); font-weight: 400; margin-left: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.dialog-actions { display: flex; align-items: center; gap: 10px; }
.dialog-actions .spacer { flex: 1; }

/* ===== 提示与告警 ===== */

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100vw - 40px));
  background: #14192a;
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
  z-index: 50;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast-err { background: #7f1d2b; }

.lock-banner {
  border: 1px solid #eec7cd;
  background: #fdf3f4;
  color: var(--red);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
}

.lock-banner p { color: #8a3a45; margin: 8px 0 0; }
.lock-banner button { margin-top: 12px; }

.file-warning {
  display: none;
  border: 1px solid #f0d9a8;
  background: #fdf7ea;
  border-radius: 8px;
  padding: 16px;
  color: var(--amber);
}

.file-warning p { color: #7a5510; margin: 8px 0 0; line-height: 1.7; }
.file-warning code { background: #f4e6c6; padding: 1px 5px; border-radius: 3px; }

.file-protocol .file-warning { display: block; }
.file-protocol .topbar, .file-protocol .view { display: none; }

.head-tools { display: flex; align-items: center; gap: 10px; }
.segmented-actions button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.hint code { background: var(--panel-2); padding: 1px 5px; border-radius: 3px; font-size: 12px; }

/* ===== 封面墙 ===== */

.wall-section + .wall-section { margin-top: 22px; }

.wall-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}

.wall-head h3 { margin: 0; font-size: 14px; color: var(--accent-strong); }
.wall-head span { color: var(--muted); font-size: 12px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}

.work-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}

.work-card:hover, .work-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(26, 32, 52, 0.14);
  border-color: var(--accent);
  outline: none;
}

.card-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  background: linear-gradient(150deg, var(--cover-a, #8b8fd0), var(--cover-b, #4a4f9e));
  display: grid;
  place-items: center;
  overflow: hidden;
}

.cover-initials {
  color: rgba(255, 255, 255, 0.92);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 1px;
  user-select: none;
}

.card-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.card-cover img.loaded { opacity: 1; }

.card-status {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 12px;
  box-shadow: 0 2px 6px rgba(20, 25, 45, 0.18);
}

.card-body { padding: 9px 10px 10px; display: grid; gap: 3px; }
.card-body strong { font-size: 14px; line-height: 1.35; }
.card-body small { color: var(--muted); font-size: 12px; line-height: 1.3; }

.card-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.card-foot .num { color: var(--text); font-weight: 600; font-size: 13px; }

.link-name {
  border: 0;
  background: none;
  padding: 0;
  min-height: 0;
  font-weight: 600;
  color: var(--accent-strong);
  cursor: pointer;
  text-align: left;
}

.link-name:hover { background: none; text-decoration: underline; }

/* ===== 名称对照 ===== */

.name-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.swap-btn { min-width: 42px; font-size: 16px; margin-bottom: 1px; }

/* ===== 详情弹窗 ===== */

.detail-dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  width: min(640px, calc(100vw - 32px));
  box-shadow: 0 24px 60px rgba(20, 25, 45, 0.22);
}

.detail-dialog::backdrop { background: rgba(20, 25, 45, 0.4); }
.detail-dialog > div { padding: 20px; display: grid; gap: 16px; }

.detail-top { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 18px; align-items: start; }
.detail-top .card-cover { border-radius: 8px; }

.detail-meta { display: grid; gap: 8px; justify-items: start; }
.detail-meta h2 { font-size: 22px; color: var(--text); line-height: 1.25; }
.detail-original { margin: 0; color: var(--muted); font-size: 14px; }

.detail-score { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.detail-score strong { font-size: 30px; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.detail-score small { color: var(--muted); }

.detail-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.detail-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }

.detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}

.detail-row span { color: var(--muted); font-size: 13px; }

.detail-review {
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: #f8f9fc;
  border-radius: 0 6px 6px 0;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ===== 档次 ===== */

.tier-badge {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  border-radius: 5px;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  letter-spacing: 0.5px;
  color: #fff;
  background: var(--muted);
}

/* 彩虹配色会花，但 S 是「神作」，值得一个独立颜色跳出来；
   A/B/C 用同一冷色族由深到浅，读起来是一条质量梯度。 */
.tier-S { background: linear-gradient(150deg, #e0b12e, #b0800a); }
.tier-A { background: linear-gradient(150deg, #6259cf, #4a41ab); }
.tier-B { background: linear-gradient(150deg, #5f88b4, #47688f); }
.tier-C { background: linear-gradient(150deg, #868f9d, #6b7481); }

.card-tier {
  position: absolute;
  top: 8px;
  right: 8px;
  box-shadow: 0 2px 6px rgba(20, 25, 45, 0.22);
}

.detail-tier { height: 26px; min-width: 28px; font-size: 15px; }

.tier-field { margin: 14px 0; }
.tier-label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }

.tier-picker { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }

.tier-picker button {
  border: 0;
  border-radius: 0;
  min-height: 40px;
  min-width: 48px;
  padding: 8px 14px;
  font-weight: 700;
  color: var(--muted);
}

.tier-picker button + button { border-left: 1px solid var(--line); }
.tier-picker button.active { background: var(--accent); color: #fff; }
.tier-picker button[data-tier="S"].active { background: linear-gradient(135deg, #d99b1c, #b8760a); }
.tier-picker button[data-tier=""] { font-weight: 500; font-size: 13px; }

.tier-hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

.anchor-hint {
  margin: 8px 0 0;
  padding: 9px 11px;
  border-left: 3px solid var(--accent);
  background: #f6f7fc;
  border-radius: 0 5px 5px 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  min-height: 20px;
}

/* ===== 看完即评 ===== */

.review-dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  width: min(600px, calc(100vw - 32px));
  box-shadow: 0 24px 60px rgba(20, 25, 45, 0.22);
}

.review-dialog::backdrop { background: rgba(20, 25, 45, 0.45); }
.review-dialog .dialog-head { margin-bottom: 10px; }
.review-dialog .full { margin-top: 14px; }
.review-dialog .full small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.review-dialog .dialog-actions { margin-top: 18px; }

.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.review-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }

/* ===== 资料搜索 ===== */

.search-dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  width: min(720px, calc(100vw - 32px));
  box-shadow: 0 24px 60px rgba(20, 25, 45, 0.22);
}

.search-dialog::backdrop { background: rgba(20, 25, 45, 0.4); }
.search-dialog .dialog-head { margin-bottom: 14px; }
.search-dialog .hint { margin: 10px 0; }

.search-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }

.search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 12px;
  margin-top: 14px;
  max-height: 46vh;
  overflow-y: auto;
}

.search-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  min-height: 0;
  text-align: left;
  border-radius: 8px;
}

.search-item .card-cover { aspect-ratio: 3 / 4; border-radius: 5px; }
.search-item .cover-initials { font-size: 15px; }

.search-meta { display: grid; gap: 2px; min-width: 0; }
.search-meta strong { font-size: 14px; line-height: 1.3; }
.search-meta small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.search-meta em { color: var(--muted); font-size: 12px; font-style: normal; }

.search-item:disabled { opacity: 0.5; cursor: progress; }

.meta-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.meta-actions button { min-height: 32px; padding: 6px 10px; font-size: 13px; }

/* 主面板里的搜索结果（不在弹窗里时的样子） */
#addSearchStage .search-results { max-height: 320px; }
#addSearchStage .search-form { margin-top: 4px; }

/* ===== 添加前的确认态 ===== */

.confirm-top {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfbfe;
  margin-bottom: 14px;
}

.confirm-top .card-cover { border-radius: 6px; }
.confirm-top .cover-initials { font-size: 22px; }

.confirm-meta { display: grid; gap: 3px; min-width: 0; }
.confirm-meta strong { font-size: 17px; line-height: 1.3; }
.confirm-meta small { color: var(--muted); font-size: 13px; }
.confirm-meta span { color: var(--muted); font-size: 13px; }
.confirm-meta em { color: var(--accent-strong); font-size: 12px; font-style: normal; margin-top: 3px; }

.confirm-form { grid-template-columns: 110px 130px 90px 150px minmax(0, 1fr) auto; }
.confirm-form button[type="submit"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.confirm-actions { margin-top: 12px; }

/* ===== 档次板与年度榜 ===== */

/* 紧凑封面卡片。刻意做小：一档动辄十几二十款，卡片一大就要换好几行，
   而档次板的意义正是「一眼看完这一档」。 */
.mini-card {
  display: grid;
  gap: 4px;
  cursor: pointer;
  border-radius: 6px;
  transition: transform 0.12s;
}

.mini-card .card-cover {
  border-radius: 7px;
  box-shadow: 0 1px 3px rgba(18, 22, 40, 0.22);
  transition: box-shadow 0.14s;
}

.mini-card .cover-initials { font-size: 18px; }

.mini-card strong {
  font-size: 11.5px;
  line-height: 1.35;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mini-card:hover, .mini-card:focus-visible { transform: translateY(-3px); outline: none; }
.mini-card:hover .card-cover, .mini-card:focus-visible .card-cover {
  box-shadow: 0 8px 20px rgba(18, 22, 40, 0.32);
}

.cover-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  box-shadow: 0 2px 6px rgba(20, 25, 45, 0.25);
}

/* 半透明压在封面上，别用实心色块跟画面抢 */
.rank-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(12, 16, 30, 0.62);
  backdrop-filter: blur(3px);
  color: rgba(255, 255, 255, 0.96);
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}

/* ===== 档次板 ===== */

.tier-board { display: grid; gap: 12px; }

.tier-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  padding: 10px;
  border-radius: 14px;
  background: #fafbfd;
  border: 1px solid var(--line-soft);
}

/* 每档一个色调，行底色只取极淡的一层：主角是封面，不是背景 */
.tier-row[data-tier="S"] { background: #fdfaef; border-color: #efe1bd; }
.tier-row[data-tier="A"] { background: #f7f6fe; border-color: #dcd8f5; }
.tier-row[data-tier="B"] { background: #f4f8fc; border-color: #d5e2ef; }
.tier-row[data-tier="C"] { background: #f7f8fa; border-color: #e2e5ea; }
.tier-row[data-tier=""] { background: #f6f7f9; border-style: dashed; }

/* 左侧色块 —— tier list 的标志性构件，撑满整行高度 */
.tier-row-label {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  padding: 12px 4px;
  border-radius: 10px;
  color: #fff;
  background: var(--muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 1px 3px rgba(20, 25, 45, 0.16);
}

.tier-row[data-tier="S"] .tier-row-label { background: linear-gradient(160deg, #e0b12e, #b0800a); }
.tier-row[data-tier="A"] .tier-row-label { background: linear-gradient(160deg, #6259cf, #4a41ab); }
.tier-row[data-tier="B"] .tier-row-label { background: linear-gradient(160deg, #5f88b4, #47688f); }
.tier-row[data-tier="C"] .tier-row-label { background: linear-gradient(160deg, #868f9d, #6b7481); }
.tier-row[data-tier=""] .tier-row-label { background: linear-gradient(160deg, #c2c8d3, #a8b0bd); }

.tier-letter {
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.tier-row-label small { font-size: 11px; color: rgba(255, 255, 255, 0.92); }
.tier-row-label em { font-size: 11px; font-style: normal; color: rgba(255, 255, 255, 0.7); }

/* 空行也要有可见高度，否则没地方拖进去 */
.tier-row-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
  min-height: 92px;
  padding: 2px;
  border-radius: 10px;
  align-content: start;
}

.tier-row-cards:empty::after {
  content: "拖到这里";
  grid-column: 1 / -1;
  align-self: center;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.12s;
}

.board-dragging .tier-row-cards:empty::after { opacity: 1; }
.board-dragging .tier-row-cards { outline: 2px dashed rgba(120, 130, 160, 0.35); outline-offset: -2px; }
.tier-row-cards.drop-target { background: rgba(79, 70, 184, 0.08); outline-color: var(--accent); }

.tier-card { cursor: grab; position: relative; }
.tier-card.dragging { opacity: 0.35; cursor: grabbing; }

/* 拖拽时关掉卡片的 hover 动效。指针会横扫大量卡片，每张都要跑一遍
   transform 过渡和阴影过渡 —— 光这一项就够让整块板顿住。 */
.board-dragging .mini-card,
.board-dragging .mini-card .card-cover { transition: none; }
.board-dragging .mini-card:hover { transform: none; }
.board-dragging .mini-card:hover .card-cover { box-shadow: 0 1px 3px rgba(18, 22, 40, 0.22); }

/* ===== 年度榜 ===== */

.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

/* 游玩年份是参考，不该抢出品年份的主位 */
.year-grid-compact { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }

.year-card {
  display: grid;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.12s;
}

.year-card:hover, .year-card:focus-visible { transform: translateY(-3px); outline: none; }

.year-card-year {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.year-grid-compact .year-card-year { font-size: 16px; }

.year-card .card-cover {
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(18, 22, 40, 0.2);
  transition: box-shadow 0.14s;
}

.year-card:hover .card-cover, .year-card:focus-visible .card-cover {
  box-shadow: 0 10px 24px rgba(18, 22, 40, 0.3);
}
.year-card .cover-initials { font-size: 24px; }
.year-grid-compact .year-card .cover-initials { font-size: 18px; }

.year-card strong {
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.year-card small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.year-grid-compact .year-card strong { font-size: 12.5px; }
.year-grid-compact .year-card small { display: none; }

.tier-none { background: #b9c0cd; }

/* ===== 响应式 ===== */

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .side-nav { position: sticky; top: 0; z-index: 5; padding: 12px; flex-direction: row; align-items: center; }
  .side-nav nav { display: flex; overflow-x: auto; }
  .brand, .nav-note { display: none; }
  .nav-item { white-space: nowrap; }
  .quick-form, .confirm-form { grid-template-columns: 1fr 1fr; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
}

@media (max-width: 720px) {
  .workspace { padding: 14px; }
  .quick-form, .confirm-form, .filter-row, .form-grid, .sync-form { grid-template-columns: 1fr; }
  .confirm-top { grid-template-columns: 72px minmax(0, 1fr); }
  .review-grid { grid-template-columns: 1fr; }
  .tier-picker { width: 100%; }
  .tier-picker button { flex: 1; min-width: 0; padding: 8px 4px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .name-pair { grid-template-columns: 1fr; }
  .swap-btn { width: 100%; }
  .detail-top { grid-template-columns: 110px minmax(0, 1fr); gap: 12px; }
  .detail-rows { grid-template-columns: 1fr; }
  .tier-row { grid-template-columns: 50px minmax(0, 1fr); gap: 8px; padding: 8px; }
  .tier-letter { font-size: 20px; }
  .tier-row-cards { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; min-height: 80px; }
  .year-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
  .year-grid-compact { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
  .year-card-year { font-size: 18px; }
  .search-results { grid-template-columns: 1fr; max-height: 40vh; }
  .search-form { grid-template-columns: 1fr; }
  .data-actions { display: grid; grid-template-columns: 1fr; }
  .bar-item { grid-template-columns: 70px minmax(0, 1fr) 40px; }
  .dialog-actions { flex-wrap: wrap; }
}
