:root {
  --bg: #05070d;
  --bg-soft: #0c1220;
  --card: rgba(255, 255, 255, 0.055);
  --card-elevated: rgba(255, 255, 255, 0.085);
  --glass: rgba(12, 18, 34, 0.46);
  --glass-strong: rgba(16, 24, 42, 0.66);
  --primary: #2f8cff;
  --primary-strong: #9ad7ff;
  --violet: #a78bfa;
  --text: #f8fafc;
  --muted: #a8b3c7;
  --line: rgba(255, 255, 255, 0.11);
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.34);
  --radius: 20px;
  --duration: 300ms;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(135deg, rgba(47, 140, 255, 0.2), transparent 30%),
    linear-gradient(245deg, rgba(167, 139, 250, 0.16), transparent 34%),
    linear-gradient(180deg, #080d1a 0%, #050711 46%, #030409 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(110deg, transparent 12%, rgba(79, 70, 229, 0.13) 32%, transparent 58%),
    linear-gradient(72deg, transparent 34%, rgba(14, 165, 233, 0.12) 54%, transparent 78%);
  filter: blur(20px);
  opacity: 0.72;
  content: "";
}

.stars,
.stars::before,
.stars::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.stars {
  z-index: -1;
  overflow: hidden;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.72) 1px, transparent 1.4px),
    radial-gradient(rgba(100, 210, 255, 0.45) 1px, transparent 1.5px);
  background-position: 0 0, 48px 42px;
  background-size: 120px 120px, 180px 180px;
  opacity: 0.13;
  animation: moveStars 80s linear infinite;
}

.stars::before {
  content: "";
  background:
    linear-gradient(120deg, transparent 18%, rgba(100, 210, 255, 0.08), transparent 46%),
    linear-gradient(36deg, transparent 42%, rgba(139, 92, 246, 0.11), transparent 70%);
  filter: blur(28px);
  opacity: 0.42;
  animation: driftNebula 24s ease-in-out infinite alternate;
}

.stars::after {
  content: "";
  background-image: radial-gradient(rgba(255, 255, 255, 0.88) 0.8px, transparent 1.2px);
  background-size: 180px 180px;
  opacity: 0.12;
  animation: moveStars 130s linear infinite reverse;
}

@keyframes moveStars {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(0, -120px, 0);
  }
}

@keyframes driftNebula {
  from {
    transform: translate3d(-1.5%, -1%, 0) scale(1);
  }

  to {
    transform: translate3d(1.5%, 1%, 0) scale(1.04);
  }
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 8, 16, 0.58);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.22);
  -webkit-backdrop-filter: saturate(190%) blur(26px);
  backdrop-filter: saturate(190%) blur(26px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 14px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: max-content;
  color: var(--text);
  text-decoration: none;
}

.brand-logo {
  position: relative;
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(190, 220, 255, 0.48);
  border-radius: 17px;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.95) 0 5px, transparent 6px),
    radial-gradient(circle at 74% 72%, rgba(191, 219, 254, 0.55) 0 9px, transparent 10px),
    linear-gradient(145deg, #3298ff 0%, #5b7dff 48%, #16213f 100%);
  box-shadow:
    0 14px 34px rgba(47, 140, 255, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.brand-logo::after {
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  content: "";
}

.logo-orbit {
  position: absolute;
  width: 54px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-right-color: transparent;
  border-radius: 50%;
  transform: rotate(-28deg);
}

.logo-text {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(15, 23, 42, 0.42);
}

.brand-copy,
.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.18rem;
  line-height: 1.1;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
}

.search {
  position: relative;
  z-index: 31;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(700px, 100%);
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 16px 40px rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  transition: transform var(--duration), width var(--duration), border-color var(--duration), box-shadow var(--duration), background var(--duration);
}

.search:focus-within {
  border-color: rgba(100, 210, 255, 0.62);
  background: rgba(255, 255, 255, 0.095);
  box-shadow:
    0 0 0 5px rgba(10, 132, 255, 0.14),
    0 20px 46px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background:
    radial-gradient(circle at 50% 45%, rgba(56, 189, 248, 0.13), transparent 25rem),
    radial-gradient(circle at 50% 62%, rgba(124, 58, 237, 0.11), transparent 28rem),
    rgba(3, 6, 14, 0.46);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

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

body.search-active .search {
  position: fixed;
  top: clamp(96px, 14vh, 150px);
  left: 50%;
  z-index: 80;
  width: min(960px, calc(100vw - 36px));
  min-height: 66px;
  padding: 0 24px;
  border-color: rgba(154, 215, 255, 0.68);
  background: rgba(12, 18, 34, 0.86);
  box-shadow:
    0 0 0 1px rgba(154, 215, 255, 0.16),
    0 26px 90px rgba(0, 0, 0, 0.48),
    0 0 58px rgba(47, 140, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transform: translateX(-50%);
}

body.search-active .site-header {
  z-index: 70;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

body.search-active .search input {
  font-size: 1.08rem;
}

.search-panel {
  position: fixed;
  top: clamp(178px, 24vh, 238px);
  left: 50%;
  z-index: 79;
  width: min(1060px, calc(100vw - 36px));
  max-height: min(660px, calc(100vh - 210px));
  padding: 22px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.045)),
    rgba(8, 13, 26, 0.82);
  box-shadow:
    0 34px 110px rgba(0, 0, 0, 0.52),
    0 0 0 1px rgba(154, 215, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  backdrop-filter: saturate(180%) blur(28px);
  transform: translateX(-50%);
}

.search-panel[hidden] {
  display: none;
}

.search-panel-head,
.search-block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.search-panel-head {
  margin-bottom: 18px;
}

.search-panel-head h2,
.search-block h3 {
  margin: 0;
}

.search-panel-head h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: 0;
}

.search-close {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.6rem;
  line-height: 1;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: transform var(--duration), background var(--duration), border-color var(--duration);
}

.search-close:hover {
  transform: rotate(90deg);
  border-color: rgba(154, 215, 255, 0.48);
  background: rgba(47, 140, 255, 0.28);
}

.search-panel-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
}

.search-block {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.search-block + .search-block,
.search-panel-grid + .search-block {
  margin-top: 14px;
}

.search-block-title span {
  color: var(--muted);
  font-size: 0.9rem;
}

.search-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}

.search-chip {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(154, 215, 255, 0.16);
  border-radius: 999px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  transition: transform var(--duration), color var(--duration), background var(--duration), border-color var(--duration);
}

.search-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(154, 215, 255, 0.44);
  color: #fff;
  background: rgba(47, 140, 255, 0.22);
}

.search-chip.category {
  background: rgba(47, 140, 255, 0.13);
}

.search-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.search-mini-card {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  text-align: left;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22);
  transition: transform var(--duration), border-color var(--duration), box-shadow var(--duration);
}

.search-mini-card:hover {
  transform: translateY(-4px);
  border-color: rgba(154, 215, 255, 0.38);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.32);
}

.search-mini-thumb {
  display: block;
  overflow: hidden;
  aspect-ratio: var(--ratio, 16 / 9);
  background: rgba(5, 9, 18, 0.72);
}

.search-mini-thumb img,
.search-mini-thumb .image-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-mini-info {
  display: grid;
  gap: 5px;
  padding: 10px;
}

.search-mini-info strong {
  overflow: hidden;
  font-size: 0.86rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-mini-info small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-hint {
  display: grid;
  min-height: 132px;
  place-items: center;
  grid-column: 1 / -1;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

.search svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.search input::placeholder {
  color: #64748b;
}

main {
  width: min(1760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 44px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  min-height: clamp(340px, 35vw, 500px);
  padding: clamp(34px, 5vw, 76px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 34px;
  background:
    linear-gradient(90deg, rgba(3, 7, 18, 0.86) 0%, rgba(3, 7, 18, 0.5) 42%, rgba(3, 7, 18, 0.16) 72%),
    linear-gradient(180deg, rgba(3, 7, 18, 0.08) 0%, rgba(3, 7, 18, 0.64) 100%),
    url("images/hero-earth-dawn.png") center / cover no-repeat;
  box-shadow:
    0 34px 110px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(154, 215, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  isolation: isolate;
}

.hero::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 50% 43%, rgba(186, 230, 253, 0.34), transparent 18%),
    linear-gradient(115deg, transparent 16%, rgba(96, 165, 250, 0.12), transparent 58%);
  content: "";
  opacity: 0.72;
  mix-blend-mode: screen;
}

.hero::after {
  position: absolute;
  inset: auto 28px 26px 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(186, 230, 253, 0.58), transparent);
  content: "";
  opacity: 0.72;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(3.6rem, 7.5vw, 7.2rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-shadow:
    0 26px 70px rgba(3, 7, 18, 0.58),
    0 0 34px rgba(147, 197, 253, 0.18);
}

.hero-text {
  max-width: 720px;
  margin: 20px 0 0;
  color: rgba(226, 232, 240, 0.9);
  font-size: clamp(1.02rem, 1.7vw, 1.28rem);
  line-height: 1.7;
  text-shadow: 0 12px 34px rgba(3, 7, 18, 0.75);
}

.hero-stats {
  display: grid;
  gap: 12px;
  min-width: 210px;
}

.hero-stats span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 54px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  background: rgba(8, 13, 26, 0.34);
  color: rgba(203, 213, 225, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 18px 46px rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: saturate(170%) blur(22px);
  backdrop-filter: saturate(170%) blur(22px);
}

.hero-stats strong {
  color: var(--text);
}

.filters {
  position: relative;
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 20px 0 14px;
  overflow: visible;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  min-height: 40px;
  padding: 0 17px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.052);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 26px rgba(0, 0, 0, 0.16);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  transition: color var(--duration), border-color var(--duration), background var(--duration), transform var(--duration);
}

.filter-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(100, 210, 255, 0.5);
  color: var(--text);
  background: rgba(255, 255, 255, 0.085);
}

.filter-btn.active {
  border-color: rgba(154, 215, 255, 0.54);
  color: white;
  background: linear-gradient(180deg, rgba(90, 180, 255, 0.88), rgba(47, 140, 255, 0.86));
  box-shadow:
    0 13px 30px rgba(47, 140, 255, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.random-btn {
  border-color: rgba(100, 210, 255, 0.28);
  color: #d8ecff;
}

.filter-menu {
  position: relative;
  flex: 0 0 auto;
}

.filter-menu-toggle::after {
  margin-left: 8px;
  color: currentColor;
  content: "⌄";
  font-size: 0.82em;
}

.filter-menu-toggle[aria-expanded="true"]::after {
  content: "⌃";
}

.filter-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  display: grid;
  min-width: 180px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 20px;
  background: rgba(10, 16, 30, 0.88);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.36);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
}

.filter-menu-panel[hidden] {
  display: none;
}

.filter-menu-item {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 13px;
  border: 0;
  border-radius: 14px;
  color: #dbeafe;
  background: transparent;
  text-align: left;
  white-space: nowrap;
}

.filter-menu-item:hover,
.filter-menu-item.active {
  color: white;
  background: rgba(47, 140, 255, 0.18);
}

.hot-rank {
  padding: 18px 0 10px;
}

main.scoped-view .hot-rank {
  padding-top: 8px;
}

.latest-section {
  padding: 18px 0 8px;
}

main.scoped-view .latest-section {
  display: none;
}

.hot-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: none;
}

.hot-tabs::-webkit-scrollbar {
  display: none;
}

.hot-tab {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  white-space: nowrap;
  transition: color var(--duration), border-color var(--duration), background var(--duration), transform var(--duration);
}

.hot-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.5);
  color: var(--text);
}

.hot-tab.active {
  border-color: rgba(10, 132, 255, 0.62);
  color: white;
  background: rgba(10, 132, 255, 0.24);
}

.hot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 20px;
}

.hot-grid .wallpaper-card {
  display: block;
  width: 100%;
  margin: 0;
  break-inside: auto;
}

.latest-grid {
  column-count: 5;
  column-gap: 20px;
}

.latest-grid .wallpaper-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 20px;
  break-inside: avoid;
}

main.scoped-view .hot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 20px;
}

main.scoped-view .hot-grid .wallpaper-card {
  display: block;
  margin: 0;
  break-inside: auto;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px auto 6px;
  padding: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

main.scoped-view .gallery-shell .pagination {
  margin-bottom: 0;
}

main.scoped-view .hot-rank .section-heading {
  margin-top: 6px;
}

.pagination[hidden] {
  display: none;
}

.pagination::-webkit-scrollbar {
  display: none;
}

.page-btn,
.page-jump button {
  display: inline-grid;
  min-width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #f8fafc;
  background:
    radial-gradient(circle at 45% 12%, rgba(255, 255, 255, 0.22), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(3, 7, 18, 0.48));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  font-weight: 800;
  transition: transform var(--duration), border-color var(--duration), box-shadow var(--duration), background var(--duration);
}

.page-btn:hover,
.page-jump button:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.45);
}

.page-btn.active {
  border-color: rgba(255, 255, 255, 0.62);
  background:
    radial-gradient(circle at 45% 18%, rgba(255, 255, 255, 0.32), transparent 34%),
    linear-gradient(145deg, rgba(59, 130, 246, 0.28), rgba(3, 7, 18, 0.96));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16), 0 16px 36px rgba(59, 130, 246, 0.22);
}

.page-btn:disabled {
  cursor: not-allowed;
  opacity: 0.38;
  transform: none;
}

.page-ellipsis {
  display: inline-grid;
  height: 42px;
  min-width: 28px;
  place-items: center;
  color: #cbd5e1;
  font-weight: 800;
}

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.page-jump input {
  width: 74px;
  height: 42px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  color: #f8fafc;
  background: rgba(15, 17, 23, 0.86);
  text-align: center;
  font-weight: 800;
  outline: none;
}

.page-jump input:focus {
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.page-jump button {
  min-width: 54px;
}

.gallery-shell {
  padding-top: 18px;
}

main.scoped-view .gallery-shell {
  padding-bottom: 4px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.72rem, 2.65vw, 2.35rem);
  letter-spacing: 0;
}

.result-count {
  margin: 0;
  color: var(--muted);
}

.masonry {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 22px;
  align-items: start;
}

.wallpaper-card {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.052);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: var(--text);
  text-align: left;
  break-inside: auto;
  -webkit-backdrop-filter: saturate(165%) blur(18px);
  backdrop-filter: saturate(165%) blur(18px);
  transform: translateY(18px);
  opacity: 0;
  transition: transform var(--duration), opacity var(--duration), box-shadow var(--duration), border-color var(--duration);
}

.wallpaper-card.visible {
  transform: translateY(0);
  opacity: 1;
}

.wallpaper-card:hover {
  border-color: rgba(154, 215, 255, 0.34);
  transform: translateY(-5px) scale(1.008);
  box-shadow:
    0 28px 66px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(154, 215, 255, 0.06),
    0 0 36px rgba(47, 140, 255, 0.08);
}

.wallpaper-card:hover .wallpaper-thumb img,
.wallpaper-card:hover .image-fallback {
  transform: scale(1.045);
}

.wallpaper-thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--ratio, 3 / 4);
  background: rgba(8, 12, 20, 0.72);
}

.wallpaper-thumb img,
.wallpaper-thumb .image-fallback {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration);
}

.image-fallback {
  display: grid;
  min-height: 0;
  place-items: center;
  padding: 20px;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  background:
    linear-gradient(145deg, rgba(59, 130, 246, 0.32), rgba(22, 27, 34, 0.2)),
    radial-gradient(circle at 72% 22%, rgba(96, 165, 250, 0.42), transparent 30%),
    radial-gradient(circle at 20% 80%, rgba(45, 212, 191, 0.22), transparent 26%),
    #111827;
}

.card-body {
  padding: 15px 16px 16px;
  background: linear-gradient(180deg, rgba(7, 12, 24, 0.58), rgba(7, 12, 24, 0.78));
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.card-title {
  margin: 0 0 10px;
  font-size: 0.98rem;
  line-height: 1.45;
  letter-spacing: 0;
}

.card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(154, 215, 255, 0.28);
  border-radius: 999px;
  color: #d8ecff;
  background: rgba(47, 140, 255, 0.14);
  font-size: 0.78rem;
  font-weight: 700;
}

.usage-pill,
.rank-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 700;
}

.rank-badge {
  color: #d8ecff;
  background: rgba(10, 132, 255, 0.18);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 240px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 26px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.empty-state[hidden] {
  display: none;
}

.empty-state strong {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 1.1rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  padding: 24px;
}

.modal.open {
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 24% 8%, rgba(10, 132, 255, 0.16), transparent 28rem),
    rgba(3, 7, 18, 0.72);
  -webkit-backdrop-filter: saturate(170%) blur(22px);
  backdrop-filter: saturate(170%) blur(22px);
}

.modal-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  width: min(1120px, 100%);
  max-height: min(860px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 30px;
  background: rgba(12, 18, 34, 0.78);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: saturate(180%) blur(26px);
  backdrop-filter: saturate(180%) blur(26px);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: white;
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: background var(--duration), transform var(--duration);
}

.modal-close:hover {
  transform: rotate(90deg);
  background: rgba(10, 132, 255, 0.78);
}

.modal-close svg,
.download-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modal-preview {
  min-height: 420px;
  background: rgba(5, 9, 18, 0.84);
}

.modal-preview img,
.modal-preview .image-fallback {
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: cover;
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 34px;
  overflow-y: auto;
}

.modal-content h2 {
  margin: 0;
  padding-right: 34px;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1.15;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  border: 0;
  border-radius: 18px;
  color: white;
  background: linear-gradient(180deg, #64d2ff, var(--primary));
  box-shadow:
    0 18px 36px rgba(10, 132, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
  font-weight: 800;
  transition: transform var(--duration), box-shadow var(--duration);
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 44px rgba(10, 132, 255, 0.38);
}

.copy-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  color: #d8ecff;
  background: rgba(255, 255, 255, 0.075);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  font-weight: 800;
  transition: transform var(--duration), border-color var(--duration), background var(--duration);
}

.copy-link-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(100, 210, 255, 0.36);
  background: rgba(10, 132, 255, 0.16);
}

.recommend-section h3 {
  margin: 0 0 12px;
}

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

.recommend-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  color: var(--text);
  background: var(--card-elevated);
  text-align: left;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.recommend-card img,
.recommend-card .image-fallback {
  aspect-ratio: var(--ratio, 16 / 9);
  min-height: 0;
  object-fit: cover;
}

.recommend-card span {
  display: block;
  padding: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
  font-weight: 700;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: min(1760px, calc(100% - 40px));
  margin: 0 auto 34px;
  padding: 18px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer span:first-child {
  color: #d8ecff;
  font-weight: 800;
}

@media (max-width: 1120px) {
  .masonry {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 18px;
  }

  .hot-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 18px;
  }

  .latest-grid {
    column-count: 3;
    column-gap: 18px;
  }

  .latest-grid .wallpaper-card {
    margin-bottom: 18px;
  }

  main.scoped-view .hot-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: 360px;
    background-position: center top;
  }

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search {
    width: 100%;
  }

  body.search-active .search {
    top: 18px;
    width: calc(100vw - 20px);
    min-height: 56px;
  }

  .search-panel {
    top: 88px;
    width: calc(100vw - 20px);
    max-height: calc(100vh - 106px);
    padding: 14px;
    border-radius: 24px;
  }

  .search-panel-grid {
    grid-template-columns: 1fr;
  }

  .search-panel-head {
    align-items: flex-start;
  }

  .search-mini-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  main {
    width: min(100% - 20px, 1480px);
    padding-top: 16px;
  }

  .hero {
    min-height: 390px;
    padding: 26px 22px;
    border-radius: 24px;
    background-position: 55% center;
  }

  .hero h1 {
    font-size: clamp(3.1rem, 18vw, 4.8rem);
  }

  .hero-text {
    line-height: 1.65;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .filters {
    gap: 8px;
  }

  .filter-menu-panel {
    right: auto;
    left: 0;
    min-width: min(220px, calc(100vw - 24px));
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

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

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

  .latest-grid {
    column-count: 2;
    column-gap: 12px;
  }

  .latest-grid .wallpaper-card {
    margin-bottom: 12px;
  }

  main.scoped-view .hot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wallpaper-card {
    border-radius: 19px;
  }

  .card-body {
    padding: 10px;
  }

  .modal {
    padding: 10px;
  }

  .modal-panel {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
  }

  .modal-preview,
  .modal-preview img,
  .modal-preview .image-fallback {
    min-height: 280px;
    max-height: 48vh;
  }

  .modal-content {
    padding: 22px;
  }

  .site-footer {
    flex-direction: column;
    gap: 6px;
    width: min(100% - 20px, 1480px);
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .stars,
  .stars::before,
  .stars::after,
  .wallpaper-card,
  .wallpaper-thumb img,
  .image-fallback {
    animation: none;
    transition: none;
  }
}
