* { box-sizing: border-box; }
:root {
  --accent: #22d3ee;
  --accent-2: #a78bfa;
  --ink: #e8ecff;
  --muted: #9aa3c7;
}
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(167, 139, 250, .28), transparent 60%),
    radial-gradient(800px 500px at 90% 0%, rgba(34, 211, 238, .2), transparent 60%),
    linear-gradient(180deg, #0a0e1f 0%, #0d1126 55%, #0a0e1f 100%);
  min-height: 100vh;
}
a { color: var(--accent); }

.top { text-align: center; padding: 28px 16px 8px; }
.top h1 {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: .04em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.top h1 span { font-size: 1.15rem; }
.sub { color: var(--muted); margin: 8px 0 0; font-size: .92rem; }

.cats {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}
.chip {
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .05);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: .9rem;
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--accent); }
.chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #06121f;
  font-weight: 700;
}

.app { max-width: 1080px; margin: 0 auto; padding: 12px 16px 32px; }

/* 舞台：大图 + 模糊背景 */
.stage {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
  background: #11152a;
  min-height: 340px;
  height: 68vh;
  max-height: 720px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.backdrop {
  position: absolute;
  inset: -5%;
  width: 110%;
  height: 110%;
  object-fit: cover;
  filter: blur(32px) brightness(.45) saturate(1.2);
  opacity: 0;
  transition: opacity .5s;
}
.main-img {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity .4s;
  z-index: 1;
}
.main-img.ready, .backdrop.ready { opacity: 1; }
.loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1.05rem;
  z-index: 2;
  background: radial-gradient(circle at 50% 50%, rgba(34, 211, 238, .08), transparent 60%);
  animation: pulse 1.4s ease-in-out infinite;
}
.loading.hidden { display: none; }
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

.info { margin-top: 14px; }
.meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 1.4em;
}
.img-title {
  font-size: .95rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.img-res {
  flex: none;
  font-size: .8rem;
  color: #06121f;
  background: var(--accent);
  border-radius: 999px;
  padding: 2px 9px;
  font-weight: 700;
}
.img-source { font-size: .85rem; text-decoration: none; }
.img-source:hover { text-decoration: underline; }

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.btn {
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .07);
  color: var(--ink);
  border-radius: 999px;
  padding: 11px 20px;
  font-size: .95rem;
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, .13); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #06121f;
  font-weight: 700;
}
.btn.faved {
  background: linear-gradient(135deg, #fbbf24, #f472b6);
  border-color: transparent;
  color: #2a0a1e;
  font-weight: 700;
}
.btn:disabled { opacity: .5; cursor: wait; transform: none; }
.counter { color: var(--muted); font-size: .85rem; margin: 10px 0 0; }

.recent, .favs { margin-top: 26px; }
.recent h2, .favs h2 { font-size: 1.05rem; margin: 0 0 10px; color: var(--ink); }
.strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.strip img, .fav-grid img {
  width: 132px;
  height: 88px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .14);
  cursor: pointer;
  flex: none;
  transition: transform .15s, border-color .15s;
}
.strip img:hover, .fav-grid img:hover { transform: scale(1.05); border-color: var(--accent); }
.strip img.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.empty { color: var(--muted); font-size: .88rem; }

.fav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}
.fav-grid img { width: 100%; height: 110px; }
.fav-item { position: relative; }
.fav-item .rm {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, .65);
  color: #fff;
  font-size: .7rem;
  cursor: pointer;
  line-height: 1;
}
.hidden { display: none; }

footer {
  text-align: center;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.7;
  padding: 8px 16px 28px;
}

@media (max-width: 640px) {
  .top h1 { font-size: 1.55rem; }
  .stage { height: 52vh; min-height: 280px; }
  .actions .btn { padding: 10px 15px; font-size: .88rem; }
  .strip img { width: 108px; height: 72px; }
}
