* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --text: #111111;
  --text-muted: #8a8a8a;
  --text-light: #b5b5b5;
  --border: #ececec;
  --border-hover: #d4d4d4;
  --radius: 14px;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

body {
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header */
.header {
  padding: 72px 0 40px;
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.header-left {
  flex: 1;
  min-width: 260px;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.logo {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tagline {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 15px;
  max-width: 620px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-muted);
  transition: border-color 0.2s;
  line-height: 1;
}

.lang-switch:hover {
  border-color: var(--border-hover);
}

.lang-option.active {
  color: var(--text);
  font-weight: 600;
}

.lang-divider {
  color: var(--text-light);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.dot {
  color: var(--text-light);
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 32px 0 24px;
  flex-wrap: wrap;
}

.search-wrap {
  flex: 1;
  max-width: 340px;
}

.search {
  width: 100%;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.search:focus {
  border-color: var(--border-hover);
}

.search::placeholder {
  color: var(--text-light);
}

.count {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  padding-bottom: 72px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, transform 0.2s;
}

.card:hover,
.card:focus-visible {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-soft);
  overflow: hidden;
}

.thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-wrap.thumb-error::after {
  content: "缩略图缺失 / No preview";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  color: var(--text-light);
  font-size: 12px;
}

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 2px 8px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
}

.card-body {
  padding: 14px 16px 16px;
}

.card-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty {
  padding: 48px 0 96px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.footer-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-light);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
}

.modal-preview {
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.modal-preview img,
.modal-preview video {
  width: 100%;
  height: auto;
  max-height: 60vh;
  display: block;
  object-fit: contain;
  background: #000;
}

.modal-preview img {
  background: var(--bg-soft);
}

.modal-info {
  padding: 22px 24px 26px;
}

.modal-info h2 {
  font-size: 20px;
  font-weight: 600;
}

.modal-info p {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.btn-download {
  display: inline-block;
  margin-top: 18px;
  padding: 10px 22px;
  background: var(--text);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-size: 14px;
  transition: opacity 0.2s;
}

.btn-download:hover {
  opacity: 0.85;
}

@media (max-width: 640px) {
  .header {
    padding: 48px 0 28px;
  }

  .logo {
    font-size: 24px;
  }

  .header-right {
    align-items: flex-start;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
  }

  .card-body {
    padding: 12px;
  }

  .modal {
    padding: 12px;
  }

  .modal-panel {
    max-height: 94vh;
    border-radius: 14px;
  }
}