:root {
  --bg: #0a0c11;
  --bg-grid: rgba(255, 255, 255, 0.028);
  --panel: #11141c;
  --panel-2: #171b25;
  --line: #262c3b;
  --line-soft: #1c2130;
  --text: #e9ecf2;
  --muted: #8a93a8;
  --pink: #fb7299;
  --cyan: #2dd4bf;
  --yellow: #fbbf24;
  --new: #22d3ee;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 75%);
}

/* ---------- buttons ---------- */

/* hidden 必须压过下面的 display，否则按钮会在加载中冒出来 */
.btn[hidden] {
  display: none;
}

.btn {
  appearance: none;
  cursor: pointer;
  display: inline-block;
  padding: 9px 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  text-decoration: none;
  text-align: center;
  border-radius: 0;
  transition: border-color 0.15s, background 0.15s, filter 0.15s;
}

.btn:hover {
  border-color: #3a4256;
  background: #1c2130;
}

/* display 会盖掉 hidden 属性，这里补回来 */
.btn[hidden] { display: none; }

.btn.primary {
  background: var(--pink);
  border-color: var(--pink);
  color: #141018;
  font-weight: 700;
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn.accent {
  background: linear-gradient(135deg, rgba(251, 114, 153, 0.2), rgba(45, 212, 191, 0.12));
  border-color: rgba(251, 114, 153, 0.5);
  color: #ffb3c8;
}

.btn.accent:hover {
  border-color: var(--pink);
  filter: brightness(1.06);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--cyan);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  text-decoration: underline;
}

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(251, 114, 153, 0.07), transparent 75%);
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 20px 22px;
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  min-width: 0;
}

.logo {
  margin: 0;
  font-family: "Consolas", "Courier New", monospace;
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 2px 2px 0 var(--pink), 4px 4px 0 rgba(0, 0, 0, 0.6);
}

.logo-mark {
  color: var(--cyan);
  text-shadow: none;
}

.tagline {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.06em;
}

#randomBtn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.search-wrap {
  max-width: 560px;
  margin-top: 16px;
}

.search-field {
  position: relative;
}

.search-btn {
  position: absolute;
  right: 5px;
  top: 5px;
  bottom: 5px;
  padding: 0 14px;
  border: 0;
  background: var(--panel-2);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.search-btn:hover {
  color: var(--cyan);
  background: #1d2230;
}

.search-btn:active {
  color: var(--text);
}

.search-history {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  padding: 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5);
}

.search-history-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.14s;
}

.search-history-item:hover {
  background: var(--panel-2);
}

.search-history-word {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text);
}

.search-history-del {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.search-history-del:hover {
  color: var(--pink);
}

.search-history-clear {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: 0;
  border-top: 1px solid var(--line-soft);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
}

.search-history-clear:hover {
  color: var(--text);
}

#search {
  width: 100%;
  padding: 11px 76px 11px 14px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 0;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#search:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
}

#search::placeholder {
  color: #5c6478;
}

/* 原生清除按钮会和搜索按钮叠在一起，藏掉 */
#search::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.hint {
  margin: 6px 0 0;
  color: #5c6478;
  font-size: 11px;
}

/* ---------- tags ---------- */

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 44px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-bar {
  align-items: center;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 14px 0 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-bottom: 1px solid var(--line-soft);
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.section-label {
  flex: 0 0 auto;
  margin-right: 10px;
  color: #5c6478;
  font-size: 11px;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.category-tab {
  appearance: none;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 10px 14px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.category-tab:hover {
  color: var(--text);
}

.category-tab[aria-pressed="true"] {
  color: #fff;
  border-bottom-color: var(--pink);
  font-weight: 700;
}

.category-tab-fav {
  color: #ff9ab5;
}

.category-tab-fav[aria-pressed="true"] {
  color: #fff;
}

.category-tab-hidden {
  color: #ff9c78;
}

.category-tab-played {
  color: #4ade80;
}

.category-tab-played[aria-pressed="true"] {
  color: #fff;
}

.category-tab-hidden[aria-pressed="true"] {
  color: #fff;
}

.fav-tab-count {
  display: inline-block;
  min-width: 16px;
  padding: 0 4px;
  margin-left: 5px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 10px;
  font-weight: 400;
  text-align: center;
}

.tag-bar {
  display: block;
  padding: 10px 0 6px;
}

.theme-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.theme-toggle {
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  font-family: inherit;
}

.theme-toggle:hover .section-label {
  color: var(--text);
}

.theme-caret {
  color: #5c6478;
  font-size: 11px;
}

.theme-summary {
  color: #5c6478;
  font-size: 11px;
}

.theme-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 9px;
}

.theme-tags[hidden] {
  display: none;
}

.tag {
  appearance: none;
  cursor: pointer;
  padding: 5px 10px;
  background: transparent;
  color: #7f889c;
  border: 1px solid var(--line-soft);
  border-radius: 0;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.tag:hover {
  color: var(--text);
  border-color: #3a4256;
  background: var(--panel);
}

.tag[aria-pressed="true"] {
  color: var(--pink);
  border-color: rgba(251, 114, 153, 0.55);
  background: rgba(251, 114, 153, 0.08);
  font-weight: 500;
}

.tag-expand {
  appearance: none;
  cursor: pointer;
  padding: 5px 4px;
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-family: inherit;
  font-size: 12px;
  white-space: nowrap;
}

.tag-expand:hover {
  text-decoration: underline;
}

.multi-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}

.multi-btn {
  appearance: none;
  cursor: pointer;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  white-space: nowrap;
  transition: color 0.15s;
}

.multi-btn:hover {
  color: var(--text);
}

.multi-btn[aria-pressed="true"] {
  color: var(--pink);
  font-weight: 700;
}

.multi-help {
  position: absolute;
  top: -8px;
  right: -10px;
  width: 15px;
  height: 15px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--yellow);
  color: #1a1400;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  cursor: help;
  z-index: 3;
}

.multi-pop {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: 240px;
  max-width: 80vw;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.multi-wrap:hover .multi-pop,
.multi-wrap.open .multi-pop {
  display: block;
}

/* ---------- applied filters ---------- */

.applied-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 0 12px;
}

.applied-bar[hidden] {
  display: none;
}

.applied-label {
  color: var(--muted);
  font-size: 12px;
}

.applied-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.applied-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid rgba(251, 114, 153, 0.4);
  background: rgba(251, 114, 153, 0.08);
  color: #ffb3c8;
  font-size: 12px;
}

.applied-chip button {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

/* ---------- toolbar ---------- */

.grid-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  margin-bottom: 12px;
  background: rgba(10, 12, 17, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}

.count {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.sort-group {
  display: inline-flex;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

/* 「最近玩过」按玩过的顺序排，四档排序在那一页不适用，直接藏起来 */
.sort-group[hidden] { display: none; }

.sort-btn {
  appearance: none;
  cursor: pointer;
  padding: 6px 12px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
}

.sort-btn + .sort-btn {
  border-left: 1px solid var(--line);
}

.sort-btn:hover {
  color: var(--text);
}

.sort-btn[aria-pressed="true"] {
  background: var(--pink);
  color: #141018;
  font-weight: 700;
}

/* ---------- grid / cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--pink);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(251, 114, 153, 0.22);
}

.card:focus-within {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.card-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #05060a;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.card-cover img,
.badges,
.card-pv {
  pointer-events: none;
}

.card-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fav-btn {
  pointer-events: auto;
}

.badges {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  gap: 5px;
  z-index: 1;
}

.badge {
  padding: 2px 6px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.badge.featured {
  background: var(--yellow);
  color: #1a1400;
}

.badge.new {
  background: var(--new);
  color: #04201c;
}

.fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 10%;
  min-width: 22px;
  max-width: 26px;
  aspect-ratio: 1 / 1;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.38);
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.fav-btn:hover {
  border-color: rgba(251, 114, 153, 0.45);
  background: rgba(0, 0, 0, 0.55);
}

.fav-btn.is-fav {
  border-color: rgba(251, 114, 153, 0.6);
  background: rgba(251, 114, 153, 0.12);
}

.fav-btn.is-fav:active {
  transform: scale(0.88);
}

.fav-btn .fav-icon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: grayscale(1) brightness(0.82);
  opacity: 0.68;
  transition: filter 0.15s, opacity 0.15s;
}

.fav-btn:hover .fav-icon {
  filter: grayscale(1) brightness(1);
  opacity: 0.92;
}

.fav-btn.is-fav .fav-icon {
  filter: drop-shadow(0 0 3px rgba(251, 114, 153, 0.55));
  opacity: 1;
}

.cover-stats {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 1;
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.68);
  border-radius: 999px;
  overflow: hidden;
  pointer-events: none;
}

.card-pv {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  color: var(--yellow);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 11px;
}

.pv-icon {
  width: 13px;
  height: 13px;
  display: block;
  flex: none;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  padding: 12px 13px 13px;
}

.card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.card-author {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.chip {
  padding: 0 6px;
  border: 1px solid var(--line);
  color: #9aa3b8;
  font-size: 11px;
  line-height: 1.6;
  white-space: nowrap;
}

.chip-cat {
  border-color: rgba(45, 212, 191, 0.32);
  color: var(--cyan);
}

.play-btn {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--pink);
  background: var(--pink);
  color: #141018;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.15s;
}

.play-btn:hover {
  filter: brightness(1.08);
}

/* ---------- 已下架 ---------- */

.badge.gone {
  background: #3a3f4b;
  color: #b8bec9;
}

.card-legacy {
  margin-left: 4px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.card-legacy-hint {
  color: #ff9c78;
}

.card.is-gone .card-cover img {
  filter: grayscale(1) brightness(0.5);
}
.card.is-gone .card-title {
  color: #8a93a8;
}
.card.is-gone .card-author-name {
  opacity: 0.6;
}

.play-btn.is-disabled {
  border-color: var(--line);
  background: #262c3b;
  color: #8a93a8;
  cursor: not-allowed;
  pointer-events: none;
}
.play-btn.is-disabled:hover {
  filter: none;
}

.modal-cover.is-gone img {
  filter: grayscale(1) brightness(0.6);
}

.btn.is-disabled {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- empty / pager ---------- */

.empty {
  border: 1px dashed var(--line);
  padding: 52px 20px;
  text-align: center;
  color: var(--muted);
}

.empty p {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 16px;
}

.empty span {
  display: block;
  margin-bottom: 14px;
  font-size: 12px;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 26px;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.page-btn:hover:not(:disabled) {
  border-color: #3a4256;
  background: var(--panel-2);
}

.page-btn.active {
  background: var(--pink);
  border-color: var(--pink);
  color: #141018;
  font-weight: 700;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-ellipsis {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.page-jump-input {
  width: 48px;
  height: 36px;
  padding: 0 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  text-align: center;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s;
}

.page-jump-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.page-jump-input:focus {
  border-color: var(--pink);
}

/* ---------- modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.modal-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  border-color: var(--pink);
}

.modal-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #05060a;
  border-bottom: 1px solid var(--line);
}

.modal-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-body {
  padding: 18px;
}

/* 详情封面左上角的徽章，和主页卡片同款位置 */
.modal-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 5px;
  z-index: 2;
  pointer-events: none;
}

.modal-title {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.35;
}

/* 「不感兴趣」：标题后面的小胶囊，半透明；点一下变成暖色实心 */
.modal-hide {
  display: inline-block;
  margin-left: 12px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  vertical-align: middle;
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.modal-hide:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.78);
}

.modal-hide.is-on {
  background: rgba(255, 138, 96, 0.16);
  border-color: rgba(255, 138, 96, 0.45);
  color: #ff9c78;
}

@media (max-width: 560px) {
  .modal-hide {
    margin-left: 8px;
    padding: 2px 9px;
    font-size: 11px;
  }
}

.modal-author {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.modal-tag {
  appearance: none;
  cursor: pointer;
  padding: 3px 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: #9aa3b8;
  font-family: inherit;
  font-size: 12px;
}

/* 标签行末尾的反馈入口：虚线框，弱化处理，但和标签同排显眼可见 */
.modal-tag-report {
  border-style: dashed !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  color: #6f7789 !important;
}

.modal-tag-report:hover {
  color: #c7ccd8 !important;
  border-color: rgba(255, 255, 255, 0.34) !important;
}

.modal-tag:hover {
  border-color: var(--pink);
  color: var(--pink);
}

.modal-tag.cat {
  border-color: rgba(45, 212, 191, 0.35);
  color: var(--cyan);
}

.modal-tag.cat:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
}

.modal-meta b {
  color: var(--yellow);
  font-family: "Consolas", "Courier New", monospace;
  font-weight: 500;
}

.modal-desc {
  margin: 0 0 18px;
  color: #c7ccd8;
  font-size: 14px;
  line-height: 1.75;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

/* 「去玩」永远靠最右 */
.modal-actions .modal-play {
  margin-left: auto;
  flex: 0 0 auto;
  min-width: 132px;
}

.modal-actions [data-modal-fav] {
  flex: 0 0 auto;
  min-width: 104px;
  text-align: center;
}

/* 手机上四个按钮排成 2×2，去玩落在右下角 */
@media (max-width: 520px) {
  .modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .modal-actions > * {
    width: 100%;
    min-width: 0;
    text-align: center;
  }
  .modal-actions .modal-play {
    margin-left: 0;
    min-width: 0;
  }
}

/* ---------- 详情数据格（3 + 2 布局） ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.stat-cell {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
}

/* 第二行只有两格，各占一半宽度，铺满不歪 */
.stat-cell-wide { grid-column: span 3; }

/* 电脑端（够宽）：五格并排一行 */
@media (min-width: 721px) {
  .stat-grid { grid-template-columns: repeat(5, 1fr); }
  .stat-cell,
  .stat-cell-wide { grid-column: auto; }
}

.stat-num {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--yellow, #fbbf24);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.stat-label {
  font-size: 11px;
  color: var(--muted, #8a93a8);
  white-space: nowrap;
}

/* ---------- 标签反馈 ---------- */
.report-toy {
  margin: 4px 0 14px;
  font-size: 13px;
  color: var(--muted, #8a93a8);
}

.report-toy b { color: #e8ebf2; font-weight: 600; }

.report-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted, #8a93a8);
}

.report-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: #e8ebf2;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.report-input:focus { border-color: var(--pink, #fb7299); }

.report-actions { margin-top: 12px; }

.report-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: #6f7789;
}

/* ---------- toast / footer ---------- */

/* 加载提示条：常驻底部，「还在加载」和「加载失败」共用 */
.load-warn {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 85;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px calc(11px + env(safe-area-inset-bottom));
  background: #221a1e;
  border-top: 1px solid rgba(251, 114, 153, 0.35);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.45);
  color: #e8dde2;
  font-size: 12.5px;
  line-height: 1.5;
}
.load-warn[hidden] { display: none; }
.load-warn-text { flex: 1 1 auto; min-width: 0; }
.load-warn-btn {
  flex: 0 0 auto;
  padding: 5px 13px;
  border: none;
  border-radius: 999px;
  background: var(--pink);
  color: #2a1206;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.load-warn-btn[hidden] { display: none; }
.load-warn-btn:active { opacity: .82; }
.load-warn-close {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #a89aa1;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.load-warn-close:active { background: rgba(255, 255, 255, .08); }

body.has-load-warn { padding-bottom: 72px; }
body.has-load-warn .toast { bottom: 84px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  max-width: 90vw;
  padding: 10px 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.err {
  border-color: #5a1f1f;
  color: #fca5a5;
}

.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 20px 16px;
  text-align: center;
  color: #5c6478;
  font-size: 11px;
}

.site-footer p {
  margin: 0;
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  .header-inner {
    padding: 22px 14px 18px;
  }

  .header-top {
    flex-wrap: wrap;
  }

  #randomBtn {
    width: auto;
    margin-left: auto;
  }

  .container {
    padding: 0 14px 32px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }

  .category-bar {
    padding-top: 10px;
  }

  .section-label {
    margin-right: 6px;
  }

  .category-tab {
    padding: 9px 11px 11px;
    font-size: 13px;
  }

  .theme-head {
    gap: 8px;
  }

  .theme-tags {
    gap: 5px;
  }

  .grid-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .card-body {
    padding: 10px;
  }

  .card-title {
    font-size: 13px;
  }

  .modal {
    padding: 0;
  }

  .modal-box {
    max-width: none;
    max-height: 100vh;
    height: 100vh;
    border: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---- 头部按钮组 / 信息弹窗 ---- */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-actions .btn {
  font-size: 13px;
  padding: 8px 14px;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .header-actions { width: 100%; justify-content: flex-start; }
  .header-actions .btn { padding: 7px 12px; font-size: 12.5px; }
}

.info-modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px; }
.info-modal[hidden] { display: none; }
.info-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.66); backdrop-filter: blur(3px); }
.info-box {
  position: relative;
  background: var(--panel, #11141c);
  border: 1px solid var(--line, #262c3b);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 82vh;
  overflow: auto;
  padding: 26px 26px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.info-close {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--panel-2, #171b25); border: 1px solid var(--line, #262c3b);
  color: var(--text, #e9ecf2); font-size: 16px; line-height: 1; cursor: pointer;
}
.info-box h2 { margin: 0 0 14px; font-size: 18px; }
.info-box h3 { margin: 18px 0 6px; font-size: 14px; color: var(--pink, #fb7299); }
.info-box p { margin: 6px 0; font-size: 13.5px; line-height: 1.7; color: var(--muted, #8a93a8); }
.info-box ul { margin: 6px 0; padding-left: 20px; }
.info-box li { margin: 5px 0; font-size: 13.5px; line-height: 1.7; color: var(--muted, #8a93a8); }
.info-box b { color: var(--text, #e9ecf2); }
.info-id {
  display: inline-block; margin: 10px 0 4px;
  padding: 8px 14px; border-radius: 10px;
  background: rgba(251, 114, 153, 0.12);
  border: 1px solid rgba(251, 114, 153, 0.35);
  color: var(--pink, #fb7299); font-weight: 700; font-size: 15px;
}
.info-link {
  display: inline-block; margin-top: 12px; padding: 9px 18px;
  border-radius: 9px; background: var(--pink, #fb7299); color: #1a0a12;
  font-weight: 700; font-size: 13.5px; text-decoration: none;
}
.info-actions {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--line, #262c3b);
}

/* ---- 标题右下角版本号 ---- */
.logo { position: relative; display: inline-block; }
.site-version {
  position: absolute;
  right: -42px;
  bottom: 1px;
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan, #2dd4bf);
  letter-spacing: 0.02em;
  text-shadow: none;
  opacity: 0.9;
  pointer-events: none;
}

/* ---- 更新日志小窗（叠在关于本站之上） ---- */
.log-modal { position: fixed; inset: 0; z-index: 96; display: flex; align-items: center; justify-content: center; padding: 28px; }
.log-modal[hidden] { display: none; }
.log-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.42); }
.log-box {
  position: relative;
  background: var(--panel, #11141c);
  border: 1px solid var(--line, #262c3b);
  border-radius: 14px;
  width: 100%;
  max-width: 400px;
  max-height: 68vh;
  overflow: auto;
  padding: 22px 22px 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}
.log-close {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--panel-2, #171b25); border: 1px solid var(--line, #262c3b);
  color: var(--text, #e9ecf2); font-size: 15px; line-height: 1; cursor: pointer;
}
.log-box h2 { margin: 0; font-size: 16px; }
.log-list { position: relative; margin-top: 16px; padding-left: 15px; }
.log-list::before {
  content: ''; position: absolute; left: 3px; top: 6px; bottom: 6px;
  width: 1px; background: rgba(255, 255, 255, 0.1);
}
.log-item { position: relative; margin-bottom: 20px; }
.log-item:last-child { margin-bottom: 4px; }
.log-item::before {
  content: ''; position: absolute; left: -15px; top: 4px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--pink, #fb7299);
  box-shadow: 0 0 0 3px rgba(251, 114, 153, 0.15);
}
.log-head { display: flex; align-items: baseline; gap: 8px; }
.log-ver {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 13px; font-weight: 800; color: var(--cyan, #2dd4bf);
}
.log-date { font-size: 11.5px; color: var(--muted, #8a93a8); }
.log-name { margin: 4px 0 6px; font-size: 14px; font-weight: 700; color: var(--text, #e9ecf2); }
.log-box ul { margin: 0; padding-left: 16px; }
.log-box li { margin: 4px 0; font-size: 12.5px; line-height: 1.65; color: var(--muted, #8a93a8); }
.log-empty { font-size: 13px; color: var(--muted, #8a93a8); }

/* ---- 评分 ---- */
.card-author {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-author-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-rating {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--yellow, #fbbf24);
  white-space: nowrap;
}

.stars { --star-size: 18px; display: inline-flex; gap: 3px; align-items: center; vertical-align: middle; }
.stars .star { position: relative; display: inline-block; width: var(--star-size); height: var(--star-size); flex: 0 0 auto; }
.stars .star-svg { display: block; width: var(--star-size); height: var(--star-size); }
.stars .star-bg { color: #39404f; }
.stars .star-clip { position: absolute; left: 0; top: 0; height: var(--star-size); overflow: hidden; }
.stars .star-fg { color: var(--yellow, #fbbf24); }
.card-favnum {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--pink, #fb7299);
  white-space: nowrap;
}
.card-rating[hidden] { display: none !important; }
.card-star { width: 12px; height: 12px; vertical-align: -1px; margin-right: 3px; color: var(--yellow, #fbbf24); }

/* ---------- 卡片胶囊：跟着当前排序只显示相关指标 ---------- */
/* 没有数据的格子显示灰色占位（♥ — / ★ —），单位始终统一 */
.card-rating.is-empty,
.card-favnum.is-empty { color: #6f7789; font-weight: 500; }
/* 灰色占位时，星星图标也要跟着变灰（它有自己的 color） */
.card-rating.is-empty .card-star { color: #6f7789; }

/* 收藏：只看收藏 */
body[data-sort="fav"] .cover-stats .card-rating { display: none !important; }
body[data-sort="fav"] .cover-stats .card-pv { display: none; }

/* 最热：只看播放量 */
body[data-sort="heat"] .cover-stats .card-rating,
body[data-sort="heat"] .cover-stats .card-favnum { display: none !important; }

/* 高分：只看评分 */
body[data-sort="rating"] .cover-stats .card-favnum { display: none; }
body[data-sort="rating"] .cover-stats .card-pv { display: none; }

/* 最新：收藏 + 播放量 */
body[data-sort="time"] .cover-stats .card-rating { display: none !important; }

/* ---------- 收藏 / 高分排序的分界提示 ---------- */
.sort-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0 6px;
  color: var(--muted, #8a93a8);
  font-size: 12.5px;
  line-height: 1.6;
}
.sort-divider-line {
  flex: 1 1 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
}
.sort-divider-text { white-space: nowrap; }

.modal-rating { margin: 8px 0 10px; }
.rating-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rating-score { font-size: 20px; color: var(--yellow, #fbbf24); }
.rating-count { font-size: 12.5px; color: var(--muted, #8a93a8); }
.rating-empty { font-size: 14px; color: var(--muted, #8a93a8); }
.rating-hint { margin: 4px 0 0; font-size: 12.5px; color: #6f7789; }
.rating-mine { font-size: 12px; color: var(--cyan, #2dd4bf); background: rgba(45,212,191,.1); border: 1px solid rgba(45,212,191,.3); border-radius: 999px; padding: 1px 8px; }
.rating-open { margin-left: auto; flex: 0 0 auto; }

.rate-pick { margin-top: 10px; display: inline-block; }
.rate-stars { position: relative; line-height: 0; }
.rate-stars .stars { --star-size: 30px; gap: 4px; }
.rate-cells {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  display: flex;
}
.rate-cell {
  flex: 1 1 0; background: transparent; border: 0; padding: 0;
  cursor: pointer;
}
.rate-pick { position: relative; }

.rate-pick[hidden] { display: none !important; }

/* 「UP主 · 日期」信息条：固定在标题下一行，不再和标题、按钮抢同一行 */
.modal-byline {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(251, 114, 153, 0.12);
  border: 1px solid rgba(251, 114, 153, 0.28);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
}

.byline-author { color: var(--pink, #fb7299); }
.byline-dot { color: #6f7789; }
.byline-date {
  color: #5ac8fa;
  font-family: "Consolas", "Courier New", monospace;
}

@media (max-width: 520px) {
  .modal-byline {
    margin: 6px 0 0;
  }
}

/* ---- 搜索框下一行：提示 + 本周评分榜入口 ---- */
.search-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}
.search-foot .hint { margin: 0; }

.rank-btn {
  flex: 0 0 auto;
  padding: 5px 13px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #fb7299 0%, #ffcf5c 100%);
  color: #2a1206;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(251, 114, 153, 0.35);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.rank-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.rank-btn:active { transform: translateY(0); }

/* ---- 评分榜弹窗 ---- */
.rank-sub { margin: -6px 0 10px; font-size: 12px; color: var(--muted, #8a93a8); }
.rank-list { margin-top: 6px; }
.rank-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line, #262c3b);
}
.rank-item:last-child { border-bottom: none; }
.rank-no {
  flex: 0 0 20px; text-align: center;
  font-size: 13px; font-weight: 800; color: var(--muted, #8a93a8);
  font-family: "Consolas", "Courier New", monospace;
}
.rank-no.top { color: #ffcf5c; }
.rank-cover {
  flex: 0 0 auto; width: 40px; height: 40px;
  border-radius: 8px; object-fit: cover; background: #1a1e28;
}
.rank-info { flex: 1; min-width: 0; }
.rank-title {
  font-size: 13px; color: var(--text, #e9ecf2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rank-meta { margin-top: 2px; font-size: 11.5px; color: var(--muted, #8a93a8); }
.rank-score {
  flex: 0 0 auto; font-size: 15px; font-weight: 800;
  color: #ffcf5c; font-family: "Consolas", "Courier New", monospace;
}
.rank-empty { margin: 16px 0; font-size: 13px; color: var(--muted, #8a93a8); line-height: 1.7; }

@media (max-width: 480px) {
  .rank-btn { font-size: 11.5px; padding: 4px 10px; }
  .search-foot .hint { font-size: 11.5px; }
}
