:root {
  --bg-gradient: linear-gradient(160deg, #fdf0f5 0%, #f5eefa 55%, #eef2fb 100%);
  --text-primary: #3d3a4e;
  --text-heading: #453a5e;
  --text-secondary: #9a8fae;
  --text-muted: #8d8299;
  --text-soft: #6d6382;
  --text-label: #8d7fa5;
  --card-bg: #ffffff;
  --chip-bg: #f4f0f9;
  --chip-hover-bg: #ece4f6;
  --border-color: rgba(183, 154, 224, 0.2);
  --border-soft: rgba(183, 154, 224, 0.15);
  --filter-bg: rgba(255, 255, 255, 0.75);
  --select-bg: #fbf9fe;
  --select-border: #e2d9ef;
  --brand-gradient: linear-gradient(135deg, #f7a8c4, #b79ae0);
  --chip-active-gradient: linear-gradient(135deg, #f498bd, #a889d8);
  --accent: #e0639a;
  --shadow-brand: 0 8px 20px rgba(199, 132, 190, 0.35);
  --shadow-filter: 0 6px 24px rgba(160, 120, 170, 0.12);
  --shadow-card: 0 6px 20px rgba(150, 110, 160, 0.12);
  --shadow-card-hover: 0 14px 32px rgba(150, 110, 160, 0.22);
  --shadow-chip-active: 0 4px 12px rgba(190, 130, 190, 0.4);
  --footer-text: #b3a9c4;
  --toggle-bg: rgba(255, 255, 255, 0.7);
  --toggle-color: #6d6382;
}

body.dark {
  --bg-gradient: linear-gradient(160deg, #221a2e 0%, #241d38 55%, #1d2030 100%);
  --text-primary: #e8e2f2;
  --text-heading: #f0eaf8;
  --text-secondary: #a294bd;
  --text-muted: #9c8fb5;
  --text-soft: #c6bade;
  --text-label: #a294bd;
  --card-bg: #2c2439;
  --chip-bg: #362c4a;
  --chip-hover-bg: #423658;
  --border-color: rgba(150, 120, 200, 0.25);
  --border-soft: rgba(150, 120, 200, 0.18);
  --filter-bg: rgba(40, 32, 56, 0.8);
  --select-bg: #332a45;
  --select-border: #4a3d63;
  --accent: #f08bb8;
  --shadow-brand: 0 8px 20px rgba(0, 0, 0, 0.4);
  --shadow-filter: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-card-hover: 0 14px 32px rgba(0, 0, 0, 0.5);
  --shadow-chip-active: 0 4px 12px rgba(0, 0, 0, 0.4);
  --footer-text: #7d7195;
  --toggle-bg: rgba(54, 44, 74, 0.85);
  --toggle-color: #d9cdf0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--text-primary);
  transition: background 0.3s ease, color 0.3s ease;
}

.site-header {
  position: relative;
  padding: 28px 24px 12px;
  text-align: center;
}

.theme-toggle {
  position: absolute;
  top: 28px;
  right: 24px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--toggle-color);
  background: var(--toggle-bg);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  transform: rotate(15deg) scale(1.06);
}

.theme-toggle svg {
  display: block;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  background: var(--brand-gradient);
  border-radius: 16px;
  box-shadow: var(--shadow-brand);
}

.brand-text h1 {
  font-size: 24px;
  letter-spacing: 6px;
  color: var(--text-heading);
}

.brand-text p {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.filter-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  max-width: 1080px;
  margin: 16px auto 8px;
  padding: 16px 20px;
  background: var(--filter-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-filter);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-group-right {
  margin-left: 0;
}

.filter-label {
  flex: 0 0 2.6em;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-label);
  white-space: nowrap;
}

.chips {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-soft);
  background: var(--chip-bg);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  background: var(--chip-hover-bg);
}

.chip.active {
  color: #fff;
  background: var(--chip-active-gradient);
  box-shadow: var(--shadow-chip-active);
}

#sortSelect {
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-soft);
  border: 1px solid var(--select-border);
  border-radius: 10px;
  background: var(--select-bg);
  cursor: pointer;
  outline: none;
}

#sortSelect:focus {
  border-color: #c0a3e6;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 24px 48px;
}

.result-count {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 22px;
}

.poster-card {
  background: var(--card-bg);
  border-radius: 18px;
  overflow: hidden;
  cursor: zoom-in;
  box-shadow: var(--shadow-card);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.poster-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card-hover);
}

.poster-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
}

.poster-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.poster-card:hover .poster-cover img {
  transform: scale(1.04);
}

.poster-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.theme-pink .poster-tag { background: rgba(244, 130, 176, 0.85); }
.theme-rose .poster-tag { background: rgba(233, 108, 152, 0.85); }
.theme-gray .poster-tag { background: rgba(120, 128, 145, 0.85); }
.theme-purple .poster-tag { background: rgba(155, 120, 210, 0.85); }

.poster-info {
  padding: 14px 16px 16px;
}

.poster-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 8px;
}

.poster-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.poster-meta strong {
  color: var(--text-soft);
  font-weight: 600;
}

.poster-price {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}

.empty-state {
  text-align: center;
  padding: 64px 0;
  color: var(--text-secondary);
}

.empty-state button {
  margin-top: 14px;
  padding: 8px 22px;
  font-size: 13px;
  color: #fff;
  background: var(--chip-active-gradient);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.site-footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--footer-text);
  border-top: 1px solid var(--border-soft);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 72px;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 22, 40, 0.82);
}

.lightbox-body {
  position: relative;
  max-width: min(640px, calc(100vw - 160px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lightbox-body img {
  max-width: 100%;
  max-height: calc(100vh - 110px);
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
  color: #efe9f7;
  font-size: 14px;
  text-align: center;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  border: none;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  transition: background 0.2s ease;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.28);
}

.lightbox-close {
  top: 20px;
  right: 24px;
  width: 42px;
  height: 42px;
  font-size: 26px;
  border-radius: 50%;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  font-size: 30px;
  border-radius: 50%;
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

@media (max-width: 640px) {
  .theme-toggle {
    top: 20px;
    right: 16px;
    width: 38px;
    height: 38px;
  }

  .filter-group {
    flex-wrap: wrap;
  }

  .lightbox {
    padding: 16px;
  }

  .lightbox-body {
    max-width: calc(100vw - 32px);
  }

  .lightbox-nav {
    top: auto;
    bottom: 12px;
    transform: none;
  }

  .lightbox-prev { left: calc(50% - 60px); }
  .lightbox-next { right: calc(50% - 60px); }
}
