:root {
  --bg: #0b1020;
  --card: #171b2b;
  --text: #f5f5f7;
  --muted: #9aa0aa;
  --accent: #0a6cff;   /* 浙江卫视蓝 */
  --accent-2: #ff8a3d; /* 跑男活力橙 */
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header ---------- */
.site-header {
  text-align: center;
  padding: calc(30px + env(safe-area-inset-top)) 16px 14px;
  background: radial-gradient(120% 90% at 50% 0%, #14224a 0%, var(--bg) 72%);
}
.banner {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px; border-radius: 999px;
  background: linear-gradient(90deg, rgba(10, 108, 255, .28), rgba(255, 138, 61, .28));
  border: 1px solid rgba(255, 255, 255, .14);
  color: #ffd9b8; font-size: 13px; font-weight: 600; letter-spacing: .5px;
  margin-bottom: 14px;
}
.banner-icon { display: inline-flex; color: var(--accent-2); }
.banner-text { white-space: nowrap; }
.site-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.site-subtitle { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 6px 16px 18px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.tab {
  border: 1px solid #2a2d35;
  background: transparent;
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
  -webkit-appearance: none;
  appearance: none;
}
.tab.active {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(10, 108, 255, .4);
}
.tab:active { transform: scale(.95); }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 12px 48px;
}
@media (min-width: 600px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 0 18px 48px; }
}
@media (min-width: 960px) {
  .grid { grid-template-columns: repeat(4, 1fr); max-width: 1200px; margin: 0 auto; }
}

.card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  cursor: pointer;
  aspect-ratio: 9 / 16;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.card img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform .35s ease;
}
.card:active img { transform: scale(1.05); }

.card .meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 22px 12px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75));
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 8px;
}
.card .name { font-size: 13px; font-weight: 600; text-shadow: 0 1px 4px rgba(0, 0, 0, .7); }
.card .cat {
  font-size: 11px; color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

.card .dl {
  position: absolute; top: 8px; right: 8px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .2s;
}
.card:hover .dl, .card:active .dl { opacity: 1; }
.card .dl svg { width: 16px; height: 16px; }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center; color: var(--muted); font-size: 12px;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .93);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.lightbox[hidden] { display: none; }
.lightbox-img {
  max-width: 100%; max-height: 72vh;
  border-radius: 10px; object-fit: contain;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .6);
  -webkit-touch-callout: default; /* 允许 iOS / 微信长按图片保存到相册 */
}
.lightbox-close {
  position: absolute; top: calc(16px + env(safe-area-inset-top)); right: 18px;
  width: 40px; height: 40px; border: none; border-radius: 50%;
  background: rgba(255, 255, 255, .15); color: #fff;
  font-size: 24px; line-height: 1; cursor: pointer;
}
.lightbox-close:active { transform: scale(.92); }
.lightbox-bar {
  display: flex; align-items: center; gap: 16px; margin-top: 18px; flex-wrap: wrap; justify-content: center;
}
.lightbox-title { color: #fff; font-size: 15px; font-weight: 600; }
.btn-download {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff; text-decoration: none;
  padding: 10px 24px; border-radius: 999px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 18px rgba(10, 108, 255, .4);
}
.btn-download:active { transform: scale(.96); }

.save-hint {
  color: #ffd6a5; font-size: 13px; font-weight: 500;
  background: rgba(255, 255, 255, .08); padding: 8px 14px; border-radius: 999px;
}

.empty-tip {
  grid-column: 1 / -1; text-align: center; color: var(--muted);
  padding: 60px 20px; font-size: 14px;
}
