/* ============================================================
 * 皮琳万事屋 · 样式文件
 * 手机优先：默认样式即手机端，桌面端通过媒体查询适配。
 * 想调配色，改下面 :root 里的颜色变量即可。
 * ============================================================ */

:root {
  --bg:        #f7f7f9;   /* 页面背景 */
  --card-bg:   #ffffff;   /* 卡片背景 */
  --text:      #1f2329;   /* 主文字 */
  --text-sub:  #6b7280;   /* 次要文字 */
  --text-light:#9aa0a8;   /* 弱化文字 */
  --primary:   #4f6ef7;   /* 主色（清爽蓝） */
  --primary-soft:#eef1ff; /* 主色浅底 */
  --line:      #eceef1;   /* 分割线 */
  --shadow:    0 2px 10px rgba(31, 35, 41, .06);
  --shadow-hover: 0 8px 22px rgba(31, 35, 41, .12);
  --radius:    14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* 保证 hidden 属性始终生效（不被 display 样式覆盖） */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

button { -webkit-tap-highlight-color: transparent; }

/* ===================== 顶部导航（手机优先） ===================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #4f6ef7, #7c9cff);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-text { font-size: 17px; font-weight: 700; letter-spacing: .3px; }

/* 上传的自定义 Logo 图片 */
.logo-img {
  height: 40px;
  max-width: 180px;
  object-fit: contain;
  display: block;
}

/* 二维码图标（右上角） */
.qr-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.qr-icon {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  color: #fff;
  background: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: transform .15s, opacity .15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  overflow: hidden;
}

.qr-icon:hover { transform: scale(1.08); opacity: .9; }
.qr-icon:active { transform: scale(.95); }

.qr-wechat { background: #07c160; }
.qr-xhs { background: #ff2442; }
.qr-douyin { background: #111; }

/* 右上角"加入圈子"提示文字 */
.qr-circle-tip {
  font-size: 12.5px;
  color: #6b7280;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}
.qr-circle-tip::after {
  content: "›";
  margin-left: 2px;
  color: #9ca3af;
}

/* ===================== 标语 ===================== */
.hero {
  text-align: center;
  padding: 26px 16px 12px;
  background: rgba(255, 255, 255, .9);   /* 与顶部导航同色，三段视觉统一 */
}

.hero p {
  color: var(--text-sub);
  font-size: 14px;
}

/* ===================== 分类（手机端可横滑）吸顶容器 ===================== */
/* 上滑时分类栏向上折叠，覆盖顶部 logo/加入圈子/标语，锁定在页面顶部；
 * 下滑回顶部 / 返回顶部 / 刷新页面时自动复原 */
.cat-sticky {
  position: sticky;
  top: 0;
  z-index: 120;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  min-height: 61px;              /* 与顶部 logo 栏同高（logo 40px + padding 10*2 + border 1），吸附时正好覆盖 */
  display: flex;
  align-items: center;
}
.cats {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 14px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.cats::-webkit-scrollbar { display: none; }

.cat-chip {
  flex-shrink: 0;
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-sub);
  font-size: 13.5px;
  cursor: pointer;
  transition: all .2s;
}

.cat-chip:hover { color: var(--primary); border-color: var(--primary); }

.cat-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ===================== 结果统计 ===================== */
.result-info {
  max-width: 1200px;
  margin: 12px auto 0;
  padding: 0 14px;
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
}

/* ===================== 壁纸瀑布流（手机 2 列） ===================== */
.wall-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 14px 40px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  contain: layout paint style;
}

.card:hover { box-shadow: var(--shadow-hover); }

.card-img-wrap {
  position: relative;
  overflow: hidden;
  background: #eef0f3;
  aspect-ratio: 9 / 16;   /* 统一占位，避免加载时布局跳动 */
}

/* 骨架屏加载动画 */
.card-img-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #eef0f3 25%, #f5f6f8 50%, #eef0f3 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  pointer-events: none;
}
.card-img-wrap.img-loaded::after { display: none; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity .4s ease, transform .35s ease;
}
.card-img.loaded { opacity: 1; }

.card:hover .card-img { transform: scale(1.03); }

/* 悬浮操作条（桌面端显示，手机端不悬浮） */
.card-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 26px 8px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.4));
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  opacity: 0;
  transition: opacity .25s;
}

@media (hover: hover) {
  .card:hover .card-actions { opacity: 1; }
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  transition: background .2s, color .2s;
}

.icon-btn:hover { background: var(--primary); color: #fff; }

/* 空状态 */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-icon { font-size: 38px; margin-bottom: 8px; }

/* 加载更多 */
.load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 0;
  color: var(--text-light);
  font-size: 13px;
}
.load-more-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e0e3e8;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.no-more {
  text-align: center;
  padding: 24px 0;
  color: #c0c4cc;
  font-size: 12.5px;
  letter-spacing: 1px;
}

/* ===================== 二维码弹窗 ===================== */
.qr-modal {
  position: fixed; inset: 0;
  background: rgba(17, 20, 28, .55);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.qr-modal-card {
  background: #fff;
  border-radius: 18px;
  padding: 26px 26px 22px;
  max-width: 300px;
  width: 100%;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.qr-modal-card img {
  width: 100%;
  max-width: 220px;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
}

.qr-modal-card p {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.qr-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: none;
  background: #f1f2f4;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  color: var(--text-sub);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-modal-close:hover { background: #e3e5e9; }

/* ===================== 壁纸预览（全屏沉浸式） ===================== */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #0d0f13;
  display: flex;
  flex-direction: column;
}

.viewer-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 14px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}

.viewer-close:hover { background: rgba(0,0,0,.7); }

.viewer-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.viewer-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  user-select: none;
  -webkit-user-drag: none;
}

/* 左右切换箭头 */
.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 8;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.16);
  color: rgba(255,255,255,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: .75;
  transition: opacity .2s, background .2s, transform .2s;
  -webkit-tap-highlight-color: transparent;
}
.viewer-nav:hover { opacity: 1; background: rgba(255,255,255,.28); }
.viewer-nav:active { transform: translateY(-50%) scale(.92); }
.viewer-nav-left { left: 14px; }
.viewer-nav-right { right: 14px; }
.viewer-nav.disabled { opacity: .22; }
@media (max-width: 640px) {
  .viewer-nav { width: 40px; height: 40px; }
  .viewer-nav-left { left: 8px; }
  .viewer-nav-right { right: 8px; }
}

/* 长按提示（灰色半透明、居中、手指按压动画） */
.viewer-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  z-index: 5;
  opacity: 1;
  transition: opacity .5s ease;
}
.viewer-hint.fade { opacity: 0; }
.hint-hand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  color: rgba(255,255,255,.82);
  background: rgba(20,22,28,.42);
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 8px 26px rgba(0,0,0,.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: hintPress 1.6s ease-in-out infinite;
}
.hint-text {
  color: rgba(255,255,255,.78);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .5px;
  text-shadow: 0 1px 6px rgba(0,0,0,.5);
  padding: 6px 16px;
  background: rgba(20,22,28,.42);
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
/* 手指按压动画：轻点下沉 + 回弹 */
@keyframes hintPress {
  0%, 100% { transform: scale(1) translateY(0); }
  40% { transform: scale(.9) translateY(5px); }
  60% { transform: scale(.94) translateY(2px); }
}
/* 波纹扩散 */
.hint-ripple {
  position: absolute;
  top: 36px;
  left: 36px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  transform: translate(-50%, -50%);
  animation: hintRipple 1.6s ease-out infinite;
  pointer-events: none;
}
@keyframes hintRipple {
  0% { width: 40px; height: 40px; opacity: .8; }
  70% { width: 120px; height: 120px; opacity: 0; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hint-hand, .hint-ripple { animation: none !important; }
}

/* ===================== 按钮 ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .15s, box-shadow .2s, background .2s, opacity .2s;
}

.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(79, 110, 247, .3);
}

.btn-primary:hover { background: #3f5de8; }

/* ===================== 提示 toast ===================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 46px;
  transform: translateX(-50%);
  max-width: 86%;
  background: rgba(28, 31, 38, .94);
  color: #fff;
  font-size: 13.5px;
  padding: 10px 20px;
  border-radius: 999px;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  text-align: center;
  animation: fadeUp .25s ease;
}

@keyframes fadeUp {
  from { transform: translate(-50%, 10px); opacity: 0; }
  to   { transform: translate(-50%, 0);    opacity: 1; }
}

/* ===================== 回到顶部 ===================== */
.back-top {
  position: fixed;
  right: 16px;
  bottom: 30px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-hover);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  z-index: 90;
}

.back-top.show { opacity: 1; pointer-events: auto; }
.back-top:hover { color: var(--primary); }

/* ===================== 底部 ===================== */
.footer {
  border-top: 1px solid var(--line);
  padding: 22px 16px;
  text-align: center;
  color: var(--text-light);
  font-size: 12.5px;
  background: #fff;
}

.footer p + p { margin-top: 4px; }
.footer-row {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 4px 14px; margin-top: 8px;
}
.footer-row a { color: var(--text-light); text-decoration: none; }
.footer-row a:hover { text-decoration: underline; }

/* ===================== 桌面端适配（辅助） ===================== */
@media (min-width: 768px) {
  .header-inner { padding: 12px 24px; }
  .hero { padding: 30px 24px 18px; }
  .hero p { font-size: 15px; }
  .cat-sticky { min-height: 65px; }
  .cats { padding: 0 24px; justify-content: center; overflow-x: visible; }
  .cat-chip { padding: 8px 20px; font-size: 14px; }
  .wall-wrap { padding: 14px 24px 60px; max-width: 1400px; margin: 0 auto; }
  .grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
  }
  .card { margin-bottom: 0; }
  .result-info { padding: 0 24px; }

  /* 宽屏：一行 8 张 */
  @media (min-width: 1100px) {
    .grid { grid-template-columns: repeat(8, 1fr); }
  }

  /* 预览：桌面端改为居中窗口 */
  .viewer {
    background: rgba(13, 15, 19, .82);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 24px;
  }
  .viewer-stage { width: min(900px, 100%); }
}


/* 性能优化：用户系统开启减少动态效果时关闭骨架动画 */
@media (prefers-reduced-motion: reduce) {
  .card-img-wrap::after, .load-more-spinner, .toast { animation: none !important; }
  .card, .card-img, .btn, .qr-icon { transition: none !important; }
}
