/* /cards page — extends the shared design tokens from ../styles.css
   (--bg, --bg-alt, --ink, --muted, --line, --blue, --shadow, --ease) */

.cards-hero {
  padding: clamp(100px, 14vw, 160px) clamp(20px, 6vw, 86px) 12px;
  max-width: 900px;
}

.cards-hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.08;
  margin-bottom: 14px;
}

.cards-search-row {
  margin-top: 26px;
}

.cards-search {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 560px;
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.cards-search svg {
  flex-shrink: 0;
  color: var(--muted);
}

.cards-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--ink);
  font-family: inherit;
  padding: 14px 0;
}

.cards-search input::placeholder {
  color: var(--muted);
}

.cards-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.cards-filters {
  position: sticky;
  top: var(--header-h, 57px);
  z-index: 5;
  padding: 14px clamp(20px, 6vw, 86px);
  background: rgba(251, 251, 253, 0.92);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cards-filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.cards-filter-tabs::-webkit-scrollbar {
  height: 4px;
}

.cards-chip {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease);
  white-space: nowrap;
}

.cards-chip:hover {
  border-color: var(--ink);
}

.cards-chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}

.cards-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

.cards-select-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}

.cards-select-field[hidden] {
  display: none;
}

.cards-select-field label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.cards-select-field select {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  padding: 0 10px;
}

.cards-clear-btn {
  min-height: 40px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.cards-clear-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.cards-results {
  padding: 24px clamp(20px, 6vw, 86px) 40px;
  min-height: 40vh;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.cards-grid[hidden] {
  display: none;
}

@media (min-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (min-width: 900px) {
  .cards-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .cards-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.cards-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
  text-align: left;
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease);
}

.cards-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.1);
}

.cards-item-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1.586 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cards-item-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.cards-item-image-wrap.is-error::after {
  content: "图片暂时无法加载";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  background: var(--bg-alt);
}

.cards-item-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cards-item-bank {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cards-item-download {
  margin-top: 2px;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-alt);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 180ms var(--ease);
}

.cards-item-download:hover {
  opacity: 0.7;
}

.cards-skeleton {
  aspect-ratio: 1.586 / 1;
  border-radius: 14px;
  background: linear-gradient(
    100deg,
    var(--bg-alt) 30%,
    rgba(255, 255, 255, 0.9) 50%,
    var(--bg-alt) 70%
  );
  background-size: 200% 100%;
  animation: cards-shimmer 1.3s ease-in-out infinite;
}

@keyframes cards-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.cards-empty {
  max-width: 480px;
  margin: 40px auto;
  text-align: center;
  color: var(--muted);
}

.cards-empty h2 {
  color: var(--ink);
  font-size: 22px;
}

.cards-empty ul {
  text-align: left;
  display: inline-block;
  margin: 12px 0;
  padding-left: 20px;
}

.cards-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  align-items: center;
  margin-top: 16px;
}

.cards-error-detail {
  font-size: 13px;
  word-break: break-word;
}

.cards-load-more-row {
  display: flex;
  justify-content: center;
  margin-top: 26px;
}

.cards-source-note {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px clamp(20px, 6vw, 86px) 60px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.cards-source-note a {
  color: var(--blue);
}

.cards-source-note a:hover {
  color: var(--blue-dark);
}

.cards-offline-state {
  max-width: 760px;
  margin: 0 auto;
  padding: 72px clamp(20px, 6vw, 86px) 60px;
}

/* Detail overlay */
.cards-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  padding: 0;
}

.cards-detail-overlay[hidden] {
  display: none;
}

@media (min-width: 720px) {
  .cards-detail-overlay {
    align-items: center;
    padding: 24px;
  }
}

.cards-detail-panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow-y: auto;
  background: white;
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

@media (min-width: 720px) {
  .cards-detail-panel {
    border-radius: 22px;
    flex-direction: row;
    max-height: 80vh;
  }
}

.cards-detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
}

.cards-detail-image-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  padding: 28px;
}

@media (min-width: 720px) {
  .cards-detail-image-wrap {
    width: 46%;
  }
}

.cards-detail-image-wrap img {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1.586 / 1;
  object-fit: contain;
}

.cards-detail-body {
  padding: 20px 24px 28px;
  flex: 1;
  min-width: 0;
}

.cards-detail-bank {
  color: var(--muted);
  margin-bottom: 12px;
}

.cards-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.cards-detail-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--muted);
}

.cards-detail-actions .button {
  width: 100%;
  min-height: 50px;
}

.cards-detail-hint {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.cards-detail-error {
  margin-top: 10px;
  font-size: 13px;
  color: #d70015;
}

.cards-detail-source {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.cards-detail-source a {
  color: var(--blue);
}

@media (max-width: 640px) {
  .cards-filters {
    top: 0;
  }

  .cards-item-name {
    font-size: 12.5px;
  }
}
