/* ============ PS5 游戏库 · 明亮优雅主题 ============ */
:root {
  --bg: #f4f7fd;
  --bg-soft: #eaf0fb;
  --card: #ffffff;
  --text: #1b2437;
  --muted: #61708d;
  --line: #e3e9f5;
  --accent: #2f6bff;
  --accent-soft: #e8efff;
  --accent2: #7c4dff;
  --gold: #f5a623;
  --green: #0eaf6d;
  --green-soft: #e3f7ee;
  --shadow: 0 2px 10px rgba(38, 68, 128, .07), 0 10px 32px rgba(38, 68, 128, .05);
  --shadow-lift: 0 6px 18px rgba(38, 68, 128, .12), 0 18px 48px rgba(38, 68, 128, .10);
  --radius: 18px;
  --hero-grad: linear-gradient(160deg, #e9f1ff 0%, #f3efff 55%, #fdf1f5 100%);
}
[data-theme="dark"] {
  --bg: #0f1420;
  --bg-soft: #171e2e;
  --card: #1a2233;
  --text: #e8edf8;
  --muted: #93a1bd;
  --line: #2a3550;
  --accent: #6d9bff;
  --accent-soft: #22304f;
  --accent2: #a88bff;
  --gold: #ffc35c;
  --green: #3fd398;
  --green-soft: #17362b;
  --shadow: 0 2px 10px rgba(0, 0, 0, .35);
  --shadow-lift: 0 8px 24px rgba(0, 0, 0, .5);
  --hero-grad: linear-gradient(160deg, #16203a 0%, #1b1730 55%, #221627 100%);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); }
::selection { background: rgba(47, 107, 255, .22); }

/* ---------- Hero ---------- */
.hero {
  background: var(--hero-grad);
  padding: 34px 0 26px;
  border-bottom: 1px solid var(--line);
}
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.brand { display: flex; gap: 14px; align-items: center; }
.logo {
  width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2f6bff, #7c4dff);
  color: #fff; flex: none;
  box-shadow: 0 6px 16px rgba(64, 90, 255, .35);
}
.hero h1 {
  margin: 0; font-size: 27px; letter-spacing: .5px;
  background: linear-gradient(100deg, #2440a8, #6a3fd8 60%, #b3449a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
[data-theme="dark"] .hero h1 { background: linear-gradient(100deg, #9db9ff, #c3a8ff 60%, #ff9ed2); -webkit-background-clip: text; background-clip: text; }
.tagline { margin: 1px 0 0; color: var(--muted); font-size: 13px; }
.hero-actions { display: flex; gap: 10px; }
.ghost-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 9px 15px; border-radius: 12px; font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.ghost-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--accent); color: var(--accent); }
.ghost-btn.icon-only { padding: 9px 11px; }
[data-theme="light"] .ico-sun { display: none; }
[data-theme="dark"] .ico-moon { display: none; }

.stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 4px; }
.stat-chip {
  background: color-mix(in srgb, var(--card) 78%, transparent);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; color: var(--muted);
  backdrop-filter: blur(6px);
}
.stat-chip b { color: var(--text); font-size: 14.5px; margin-right: 3px; }
.stat-chip.hl { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--accent); }

.search-box {
  margin-top: 16px; display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: 16px; padding: 4px 14px;
  box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent), var(--shadow); }
.search-box svg { color: var(--muted); flex: none; }
#searchInput {
  flex: 1; border: 0; outline: 0; background: none;
  font-size: 15.5px; color: var(--text); padding: 11px 0; min-width: 0;
}
#searchInput::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
#searchInput::-webkit-search-cancel-button { display: none; }
.clear-btn {
  border: 0; background: var(--bg-soft); color: var(--muted);
  width: 26px; height: 26px; border-radius: 50%; font-size: 12px; flex: none;
}
.clear-btn:hover { background: var(--accent-soft); color: var(--accent); }
.kbd-slash {
  flex: none; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
  font-size: 11.5px; color: var(--muted); padding: 1px 7px; background: var(--bg-soft);
}
@media (max-width: 640px) { .kbd-slash { display: none; } }
.hero-tip { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.hero-tip b { color: var(--green); }

/* ---------- Sticky toolbar ---------- */
.toolbar-sticky {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 10px 0 8px;
}
.toolbar-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.toolbar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  padding: 6px 13px; border-radius: 999px; font-size: 13px; white-space: nowrap;
  transition: all .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 35%, transparent); }
.chip-count { opacity: .75; font-size: 11.5px; }
#sortSelect {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 10px; padding: 7px 10px; font-size: 13px; outline: none;
}
.letter-bar { display: flex; gap: 3px; margin-top: 9px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.letter-bar::-webkit-scrollbar { display: none; }
.letter-chip {
  flex: none; border: 0; background: none; color: var(--muted);
  min-width: 30px; padding: 4px 6px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  position: relative; transition: all .12s;
}
.letter-chip small { display: block; font-size: 9.5px; font-weight: 500; opacity: .55; }
.letter-chip:hover { background: var(--accent-soft); color: var(--accent); }
.letter-chip.on { background: var(--accent); color: #fff; }
.letter-chip.on small { opacity: .8; }

/* ---------- Recent ---------- */
.recent-section { margin-top: 18px; }
.recent-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.text-btn { border: 0; background: none; color: var(--muted); font-size: 12.5px; padding: 2px 4px; }
.text-btn:hover { color: #e5484d; }
.recent-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.recent-row::-webkit-scrollbar { display: none; }
.recent-item {
  flex: none; display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 5px 12px 5px 5px; font-size: 13px; max-width: 240px;
}
.recent-item img { width: 30px; height: 38px; border-radius: 7px; object-fit: cover; }
.recent-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item:hover { border-color: var(--accent); }

/* ---------- Grid & cards ---------- */
.result-meta { margin: 20px 0 12px; font-size: 13.5px; color: var(--muted); }
.result-meta b { color: var(--text); }
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 20px; } }
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
  cursor: pointer; position: relative;
  content-visibility: auto; contain-intrinsic-size: 320px;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.cover { position: relative; aspect-ratio: 4/5; background: var(--bg-soft); overflow: hidden; }
.cover .ph {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 42px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #7f9bd8, #a58bd8);
}
.cover img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity .35s ease, transform .35s ease;
}
.cover img.loaded { opacity: 1; }
.card:hover .cover img.loaded { transform: scale(1.045); }
.mini-chip.zh { color: var(--green); background: var(--green-soft); font-weight: 600; }
.fav-btn {
  position: absolute; right: 8px; top: 8px;
  width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .82); color: #b3bdd4;
  display: grid; place-items: center; font-size: 15px;
  transition: transform .15s, color .15s;
  backdrop-filter: blur(4px);
}
.fav-btn:hover { transform: scale(1.15); color: var(--gold); }
.fav-btn.on { color: var(--gold); }
.card-body { padding: 11px 12px 12px; }
.card-title {
  font-size: 14px; font-weight: 600; line-height: 1.4; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 39px;
}
.card-title mark { background: color-mix(in srgb, var(--gold) 32%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.card-en {
  font-size: 12px; color: var(--muted); margin: 3px 0 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta { display: flex; align-items: center; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.mini-chip {
  font-size: 11px; color: var(--muted); background: var(--bg-soft);
  padding: 2px 8px; border-radius: 6px; font-variant-numeric: tabular-nums;
}
.copy-quick {
  margin-left: auto; border: 1px solid var(--line); background: var(--card);
  border-radius: 8px; width: 28px; height: 26px; display: grid; place-items: center;
  color: var(--muted); transition: all .15s;
}
.copy-quick:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.copy-quick svg { width: 14px; height: 14px; }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-emoji { font-size: 52px; margin-bottom: 8px; }
.primary-btn {
  margin-top: 16px; border: 0; border-radius: 12px; padding: 11px 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-size: 14.5px; font-weight: 600;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}
.primary-btn:hover { transform: translateY(-1px); }

/* ---------- Guide / FAQ ---------- */
.guide { padding: 46px 20px 30px; }
.guide h2 { font-size: 20px; margin: 34px 0 6px; }
.guide h2:first-child { margin-top: 0; }
.guide-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }
.guide-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.guide-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.guide-card h3 { margin: 0 0 6px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.guide-card .fmt-tag {
  font-size: 11px; font-weight: 700; color: #fff; border-radius: 6px; padding: 2px 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  font-family: ui-monospace, monospace;
}
.guide-card p { margin: 0; font-size: 13.2px; color: var(--muted); }
.guide-card .fit { margin-top: 9px; font-size: 12.3px; color: var(--accent); }
.faq { display: grid; gap: 10px; }
.faq details {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 0 16px; box-shadow: var(--shadow);
}
.faq summary { cursor: pointer; font-size: 14.5px; font-weight: 600; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 18px; color: var(--muted); font-weight: 400; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.faq details p b { color: var(--text); }
.steps {
  margin: 8px 0 0; padding: 18px 20px 18px 40px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); font-size: 13.8px;
}
.steps li { margin: 8px 0; }
.steps li::marker { color: var(--accent); font-weight: 700; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 44px; padding: 22px 0 30px; color: var(--muted); font-size: 13px; text-align: center; }
.footer p { margin: 4px 0; }
.footer-sub { font-size: 12px; }

/* ---------- Modal ---------- */
.modal-mask[hidden] { display: none; }
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(18, 26, 46, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 18px;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  position: relative; width: min(720px, 100%); max-height: min(86vh, 780px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--card); border-radius: 22px; box-shadow: 0 24px 80px rgba(0,0,0,.35);
  animation: popIn .22s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes popIn { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.modal-close {
  position: sticky; top: 12px; float: right; right: 12px; z-index: 5;
  width: 34px; height: 34px; margin-right: 12px; border: 0; border-radius: 50%;
  background: rgba(120, 132, 160, .18); color: var(--text); font-size: 14px;
  backdrop-filter: blur(4px);
}
.modal-close:hover { background: var(--accent); color: #fff; }
.m-head { display: flex; gap: 18px; padding: 22px 24px 0; clear: both; }
.m-cover { flex: none; width: 168px; }
.m-cover .cover { border-radius: 14px; box-shadow: var(--shadow-lift); aspect-ratio: 4/5; }
.m-info { min-width: 0; }
.m-cn { margin: 4px 0 0; font-size: 21px; line-height: 1.35; }
.m-en { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.m-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.m-badge {
  font-size: 12px; padding: 3.5px 10px; border-radius: 999px;
  background: var(--bg-soft); color: var(--muted);
}
.m-badge.zh { background: var(--green-soft); color: var(--green); font-weight: 600; }
.m-badge.id { font-family: ui-monospace, SFMono-Regular, monospace; cursor: pointer; }
.m-badge.id:hover { background: var(--accent-soft); color: var(--accent); }
.m-body { padding: 18px 24px 24px; }
/* facts row: size / genre / release */
.m-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 0 0 6px; }
.fact { background: var(--bg-soft); border-radius: 12px; padding: 9px 12px; min-width: 0; }
.fact span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 1px; }
.fact b { font-size: 13.5px; line-height: 1.35; word-break: break-all; }
.fact i { display: block; font-style: normal; font-size: 10.5px; color: var(--muted); opacity: .8; }
.m-desc { margin: 0; font-size: 13.8px; line-height: 1.8; text-align: justify; white-space: pre-line; }
.m-src { margin-top: 12px; font-size: 11.5px; color: var(--muted); opacity: .85; }

.m-sec-title { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .5px; margin: 18px 0 9px; display: flex; align-items: center; gap: 8px; }
.m-sec-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.ver-pills { display: flex; gap: 7px; flex-wrap: wrap; }
.ver-pill {
  border: 1.5px solid var(--line); background: var(--card); color: var(--text);
  padding: 6px 13px; border-radius: 999px; font-size: 13px; font-variant-numeric: tabular-nums;
}
.ver-pill.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.link-list { display: grid; gap: 9px; }
.link-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px;
  background: var(--bg-soft);
  transition: border-color .15s;
}
.link-row:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.link-name { flex: none; width: 158px; }
.link-name b { display: block; font-size: 13.5px; }
.link-name span { font-size: 11px; color: var(--muted); }
.link-url {
  flex: 1; min-width: 0; font-size: 12px; color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; border: 0; background: none; padding: 0; text-align: left;
}
.link-url:hover { color: var(--accent); }
.mini-btn {
  flex: none; border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 9px; padding: 6.5px 12px; font-size: 12.5px;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all .15s; text-decoration: none;
}
.mini-btn:hover { border-color: var(--accent); color: var(--accent); }
.mini-btn.solid { background: var(--accent); border-color: var(--accent); color: #fff; }
.mini-btn.solid:hover { opacity: .88; color: #fff; }
.mini-btn svg { width: 13px; height: 13px; }
.m-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 20px; }
.m-tip {
  margin-top: 14px; font-size: 12.5px; color: var(--muted);
  background: var(--bg-soft); border-radius: 11px; padding: 10px 13px;
}
.m-fav { margin-left: auto; }
@media (max-width: 560px) {
  .m-head { flex-direction: column; align-items: center; text-align: center; padding: 18px 16px 0; }
  .m-cover { width: 132px; }
  .m-badges { justify-content: center; }
  .m-body { padding: 14px 16px 20px; }
  .link-name { width: 96px; }
  .link-url { display: none; }
  .m-facts { grid-template-columns: 1fr 1fr; }
}

/* ---------- screenshots strip & lightbox ---------- */
.shots { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.shot { flex: none; border: 0; padding: 0; background: none; border-radius: 10px; overflow: hidden; cursor: zoom-in; }
.shot img { height: 120px; width: auto; display: block; border-radius: 10px; border: 1px solid var(--line); transition: border-color .15s, transform .15s; }
.shot:hover img { border-color: var(--accent); transform: translateY(-2px); }
.lightbox {
  position: fixed; inset: 0; z-index: 300; background: rgba(8, 12, 24, .92);
  display: grid; place-items: center; padding: 24px; cursor: zoom-out;
  animation: fadeIn .18s ease;
}
.lightbox img { max-width: 94vw; max-height: 88vh; border-radius: 12px; box-shadow: 0 20px 80px rgba(0,0,0,.6); }

/* ---------- Back top / Toast ---------- */
.back-top {
  position: fixed; right: 22px; bottom: 24px; z-index: 60;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--card); color: var(--accent); box-shadow: var(--shadow-lift);
  display: grid; place-items: center; opacity: 0; pointer-events: none;
  transform: translateY(8px); transition: all .25s;
}
.back-top.show { opacity: 1; pointer-events: auto; transform: none; }
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(16px);
  z-index: 200; background: #1b2437; color: #fff;
  padding: 10px 20px; border-radius: 999px; font-size: 13.5px;
  opacity: 0; pointer-events: none; transition: all .25s;
  box-shadow: 0 10px 30px rgba(0,0,0,.3); max-width: 86vw; text-align: center;
}
[data-theme="dark"] .toast { background: #e8edf8; color: #1b2437; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .ok { color: #6ee7b7; margin-right: 4px; }

/* skeleton */
.skel { border-radius: var(--radius); background: linear-gradient(100deg, var(--bg-soft) 40%, color-mix(in srgb, var(--card) 60%, var(--bg-soft)) 50%, var(--bg-soft) 60%); background-size: 200% 100%; animation: shimmer 1.4s infinite; aspect-ratio: 4/5.9; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- mobile polish ---------- */
@media (max-width: 640px) {
  .chip-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; max-width: 100%; padding-bottom: 2px; }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip-row .chip { flex: none; }
  .toolbar-right { width: 100%; flex-wrap: nowrap; }
  .toolbar-right #formatChips { flex: 1; }
  #sortSelect { flex: none; }
  .hero { padding: 24px 0 20px; }
  .hero h1 { font-size: 22px; }
  .logo { width: 44px; height: 44px; border-radius: 13px; }
  .stats { gap: 6px; margin-top: 14px; }
  .stat-chip { padding: 5px 11px; font-size: 12px; }
  .grid { gap: 12px; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  .card-title { font-size: 13px; min-height: 36px; }
  .guide { padding-top: 32px; }
}
