:root {
  --bg: #0e1014;
  --bg-2: #161a21;
  --panel: #1b2029;
  --line: #2a313d;
  --text: #e8edf4;
  --muted: #8b95a5;
  --accent: #ffd24a;
  --accent-2: #ff5da2;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1c2230 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* 顶栏 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 16, 20, 0.7);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; }
.topbar h1 { font-size: 19px; margin: 0; letter-spacing: 0.5px; }
.sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.progress { display: flex; align-items: center; gap: 10px; }
.prog-ring {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--accent) var(--p, 0%), #2a313d 0);
  position: relative;
}
.prog-ring::before {
  content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--bg-2);
}
.prog-ring span { position: relative; font-size: 12px; font-weight: 700; }
.prog-label { font-size: 12px; color: var(--muted); }

/* 控制栏 */
.controls {
  padding: 16px 22px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
}
.search-wrap input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.search-wrap input:focus { border-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}
.chip:hover { color: var(--text); border-color: #3a4456; }
.chip.active {
  background: linear-gradient(135deg, var(--accent), #ffb14a);
  color: #1a1408;
  border-color: transparent;
  font-weight: 700;
}
.chip.rarity.active { color: #15110a; }

.right-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.view-count { font-size: 13px; color: var(--muted); margin-right: auto; }
.btn-lightup {
  padding: 9px 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 14px; cursor: pointer; font-weight: 600;
}
.btn-lightup.on {
  background: linear-gradient(135deg, var(--accent-2), #ff8a3d);
  border-color: transparent; color: #fff;
  box-shadow: 0 0 16px rgba(255, 93, 162, 0.4);
}
.btn-ghost {
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-size: 13px; cursor: pointer;
}
.btn-ghost:hover { color: var(--text); }

/* 网格 */
main { max-width: 1400px; margin: 0 auto; padding: 14px 22px 40px; }
.grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-flow: row dense;
  gap: 12px;
}
/* 横向卡图：占两格，高度=一张竖卡 */
.card.is-wide { grid-column: span 2; }
.card.is-wide .thumb { aspect-ratio: 10 / 7; }
/* 超宽海报（PI 等，宽高比>2）：占三格，两张一行 */
.card.is-ultra { grid-column: span 3; }
.card.is-ultra .thumb { aspect-ratio: 15 / 7; }
.card {
  position: relative;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  min-width: 0;
  text-align: center;
  color: inherit;
  transition: transform 0.12s;
}
.card:hover { transform: translateY(-2px); }
.thumb {
  position: relative;
  aspect-ratio: 5 / 7;
  display: grid; place-items: center;
  overflow: hidden;
  border-radius: 10px;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; position: relative; z-index: 1; }
.ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.ph-no { font-size: 12px; font-weight: 700; color: #4b5361; letter-spacing: 0.5px; }

.meta { padding: 13px 10px 12px; text-align: center; }
.meta .no { display: block; font-size: 11px; color: var(--muted); letter-spacing: .3px; text-align: center; }
.meta .nm {
  display: block; font-size: 13px; font-weight: 600; margin-top: 4px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 点亮状态：没点亮图片变灰，点亮恢复原色（始终生效，与模式无关） */
.card .thumb img { filter: grayscale(1) brightness(0.6); transition: filter .15s ease; }
.card.owned .thumb img { filter: none; }
.card:not(.owned):hover .thumb img { filter: grayscale(1) brightness(0.74); }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* 页脚 */
.foot {
  max-width: 1400px; margin: 0 auto; padding: 20px 22px 40px;
  font-size: 12px; color: var(--muted); border-top: 1px solid var(--line);
}
.foot code { background: var(--panel); padding: 1px 6px; border-radius: 5px; color: var(--text); }
.foot .muted { opacity: 0.8; margin-top: 6px; }

/* 灯箱：图片居中放大，信息单独立在一个带背景的小窗口里 */
.lightbox { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.lightbox[hidden] { display: none; }
.lb-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.78); backdrop-filter: blur(4px); }
.lb-panel {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  max-width: 1100px; width: calc(100% - 40px); max-height: calc(100vh - 40px); overflow: auto;
}
.lb-close {
  position: absolute; top: 10px; right: 12px;
  background: transparent; border: none; color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1;
}
.lb-img {
  position: relative;
  display: flex; justify-content: center;
}
.lb-img img { display: block; width: auto; height: auto; max-width: min(92vw, 1100px); max-height: 82vh; object-fit: contain; }
/* 信息小窗口：独立背景 */
.lb-info {
  width: 100%; max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.lb-no { font-size: 13px; color: var(--muted); }
.lb-info h2 { margin: 0; font-size: 22px; }
.lb-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.r { color: #15110a; border-color: transparent; font-weight: 700; }
/* 拥有按钮：默认黑，点亮后变绿 */
.btn-own {
  margin-top: 4px;
  padding: 11px 20px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer;
  background: #15181f; color: #fff; font-size: 15px; font-weight: 700;
}
.btn-own.is-owned { background: #2ecc71; color: #06281a; border-color: transparent; }

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
}
