/* ===== 基础 ===== */
:root{
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* 过冲回弹：Q弹手感 */
  --fade: 1000ms;
  --fg: #fff;
  --fg-dim: rgba(255,255,255,.72);
  --panel: rgba(20,20,24,.46);
  --panel-brd: rgba(255,255,255,.14);
}
*{ box-sizing: border-box; margin: 0; padding: 0; }
html, body{ height: 100%; }
body{
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #07070a;
  color: var(--fg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
body.on-light{
  --fg: #0c0c0e;
  --fg-dim: rgba(0,0,0,.6);
  --panel: rgba(255,255,255,.5);
  --panel-brd: rgba(0,0,0,.08);
}

/* ===== 全屏壁纸舞台 ===== */
.stage{ position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #07070a; }
.layer{
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0; transform: scale(1.06);
  transition: opacity var(--fade) var(--ease), transform 1700ms var(--ease);
  will-change: opacity, transform;
}
.layer.active{ opacity: 1; transform: scale(1); }

.watermark{
  position: absolute; inset: 0; z-index: 1;
  background-repeat: repeat; pointer-events: none;
  opacity: 0; transition: opacity 700ms ease;
}
.watermark.show{ opacity: 1; }

.vignette{
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(to bottom,
    rgba(0,0,0,.34), transparent 20% 55%, rgba(0,0,0,.6));
}

/* ===== 顶栏 ===== */
.topbar{
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px 34px;
}
.brand{
  font-weight: 800; letter-spacing: .14em; font-size: 19px; color: var(--fg);
  text-shadow: 0 1px 14px rgba(0,0,0,.35);
}
.brand span{ font-weight: 500; opacity: .62; letter-spacing: .05em; margin-left: 4px; }
.top-actions{ display: flex; gap: 10px; }
.ghost{
  appearance: none; cursor: pointer;
  font: inherit; font-size: 14px; color: var(--fg);
  padding: 9px 18px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--panel-brd);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  transition: transform .35s var(--ease), background .35s ease, opacity .3s ease;
}
.ghost:hover{ transform: translateY(-1px); background: rgba(255,255,255,.16); }

/* ===== 底部操作区 ===== */
.dock{
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; flex-direction: column; gap: 18px; padding-bottom: 30px;
}

/* 当前壁纸信息 + 下载 */
.hud{
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  padding: 0 34px; pointer-events: none;
}
.hud > *{ pointer-events: auto; }
.meta .title{
  font-size: 40px; font-weight: 700; letter-spacing: .01em; line-height: 1.05;
  text-shadow: 0 2px 26px rgba(0,0,0,.4);
}
.meta .sub{ margin-top: 8px; font-size: 14px; color: var(--fg-dim); text-shadow: 0 1px 12px rgba(0,0,0,.4); }
.download{
  appearance: none; cursor: pointer; font: inherit; font-size: 15px; font-weight: 600;
  color: var(--fg); display: inline-flex; align-items: center; gap: 9px;
  padding: 14px 24px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--panel-brd);
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  transition: transform .4s var(--ease), background .35s ease;
  box-shadow: 0 8px 40px rgba(0,0,0,.28);
}
.download:hover{ transform: translateY(-2px) scale(1.02); background: rgba(255,255,255,.2); }
.download svg{ opacity: .9; }

/* 分类条：可左右滑动，选中放大变亮 */
.cats{
  display: flex; gap: 26px; align-items: center; padding: 4px 34px;
  overflow-x: auto; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
          mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
}
.cats::-webkit-scrollbar{ display: none; }
.cat{
  flex: 0 0 auto; cursor: pointer; white-space: nowrap;
  font-size: 15px; font-weight: 600; color: var(--fg);
  opacity: .42; transform: scale(1); transform-origin: center bottom;
  text-shadow: 0 1px 12px rgba(0,0,0,.4);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}
.cat:hover{ opacity: .8; }
.cat.active{ opacity: 1; transform: scale(1.36); }
.cat.disabled{ opacity: .16; pointer-events: none; transform: none; }

/* 缩略图轨：一排小方块 */
.rail{
  display: flex; gap: 14px; align-items: flex-end; padding: 42px 34px 0;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  transition: opacity .3s var(--ease);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
          mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
}
.rail::-webkit-scrollbar{ display: none; }
.rail.switching{ opacity: 0; }
.thumb{
  flex: 0 0 auto; width: 86px; height: 86px; border-radius: 18px; cursor: pointer;
  background-size: cover; background-position: center;
  outline: 0 solid rgba(255,255,255,0); outline-offset: 3px;
  transform-origin: center bottom; will-change: transform;
  opacity: .5; transform: translateY(0) scale(1);
  transition: transform .5s var(--spring), opacity .35s var(--ease), outline-color .4s ease, outline-width .35s ease;
  box-shadow: 0 6px 22px rgba(0,0,0,.32);
}
.thumb.active{
  opacity: 1; transform: translateY(-9px) scale(1.13);
  outline: 2.5px solid rgba(255,255,255,.92);
}
/* 鼠标在缩略图区内：跟手放大用更快的过渡；离开时回落用上面的弹性曲线（Q弹） */
.rail.magnifying .thumb{ transition: transform .13s ease-out, opacity .13s ease-out; }

/* ===== 弹窗 ===== */
.modal-mask{
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(6,6,9,.5);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; visibility: hidden; transition: opacity .4s ease, visibility .4s;
}
.modal-mask.show{ opacity: 1; visibility: visible; }
.modal{
  position: relative; width: 100%; max-width: 440px;
  background: rgba(26,26,31,.86); border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px; padding: 34px 32px 30px; color: #fff;
  backdrop-filter: blur(30px) saturate(1.3); -webkit-backdrop-filter: blur(30px) saturate(1.3);
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
  transform: translateY(16px) scale(.97); transition: transform .45s var(--ease);
}
.modal-mask.show .modal{ transform: translateY(0) scale(1); }
.modal h2{ font-size: 22px; font-weight: 700; }
.modal-sub{ margin-top: 8px; font-size: 14px; color: rgba(255,255,255,.66); line-height: 1.5; }
.modal-sub b, .share-note b{ color: #fff; }
.x{
  position: absolute; top: 18px; right: 18px; cursor: pointer;
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.1); color: #fff; font-size: 13px;
  transition: background .3s ease;
}
.x:hover{ background: rgba(255,255,255,.22); }

.buy-grid{ display: flex; align-items: stretch; gap: 14px; margin-top: 24px; }
.opt{
  flex: 1; cursor: pointer; text-align: center; color: #fff;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; padding: 20px 16px;
  transition: transform .35s var(--ease), background .3s ease, border-color .3s ease;
}
.opt:hover{ transform: translateY(-3px); background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); }
.opt-login{ display: flex; flex-direction: column; justify-content: center; }
.opt-title{ font-size: 15px; font-weight: 600; margin-top: 12px; }
.opt-login .opt-title{ margin-top: 0; }
.opt-desc{ font-size: 12px; color: rgba(255,255,255,.55); margin-top: 6px; line-height: 1.4; }
.or{ display: flex; align-items: center; }
.or span{ font-size: 12px; color: rgba(255,255,255,.4); }
.qr{
  width: 120px; height: 120px; margin: 0 auto; background: #fff;
  border-radius: 12px; padding: 9px; display: grid;
  grid-template-columns: repeat(21, 1fr); grid-template-rows: repeat(21, 1fr); gap: 0;
}
.qr i{ background: transparent; }
.qr i.on{ background: #0b0b0c; }
.share-note{
  margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1);
  font-size: 13px; color: rgba(255,255,255,.6); text-align: center; line-height: 1.5;
}

.drop{
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; margin-top: 22px; height: 120px; cursor: pointer; text-align: center;
  border: 1.5px dashed rgba(255,255,255,.24); border-radius: 16px;
  font-size: 14px; color: rgba(255,255,255,.8); transition: border-color .3s, background .3s;
}
.drop span{ font-size: 12px; color: rgba(255,255,255,.45); }
.drop:hover{ border-color: rgba(255,255,255,.45); background: rgba(255,255,255,.04); }
.drop-hint{ display: flex; flex-direction: column; align-items: center; gap: 6px; }
.drop.drag{ border-color: rgba(255,255,255,.6); background: rgba(255,255,255,.06); }
.drop.has-img{ border-style: solid; border-color: rgba(255,255,255,.3); background-size: cover; background-position: center; }
.drop.has-img .drop-hint{ display: none; }
.field{
  width: 100%; margin-top: 14px; padding: 13px 16px; font: inherit; font-size: 14px;
  color: #fff; background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14); border-radius: 12px;
}
.field::placeholder{ color: rgba(255,255,255,.4); }
.field:focus{ outline: none; border-color: rgba(255,255,255,.4); }
select.field{
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
select.field option{ background: #1c1c22; color: #fff; }
.check{
  display: flex; align-items: flex-start; gap: 9px; margin-top: 16px;
  font-size: 13px; color: rgba(255,255,255,.66); line-height: 1.45; cursor: pointer;
}
.check input{ margin-top: 2px; accent-color: #fff; }
.primary{
  width: 100%; margin-top: 20px; cursor: pointer; font: inherit; font-size: 15px; font-weight: 600;
  color: #0b0b0c; background: #fff; border: none; border-radius: 12px; padding: 14px;
  transition: transform .35s var(--ease), opacity .3s ease;
}
.primary:hover{ transform: translateY(-2px); }

/* ===== Toast ===== */
.toast{
  position: fixed; left: 50%; bottom: 38px; z-index: 200;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15,15,18,.92); color: #fff; font-size: 14px;
  padding: 13px 22px; border-radius: 999px; border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  opacity: 0; visibility: hidden; transition: opacity .35s ease, transform .35s var(--ease), visibility .35s;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.toast.show{ opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ===== 响应式 ===== */
@media (max-width: 640px){
  .topbar{ flex-wrap: wrap; row-gap: 12px; padding: 16px 18px; }
  .dock{ gap: 14px; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .hud{ padding: 0 20px; flex-direction: column; align-items: flex-start; gap: 14px; }
  .cats{ padding: 4px 20px; gap: 22px; }
  .meta .title{ font-size: 30px; }
  .rail{ padding: 22px 20px 0; }
  .thumb{ width: 72px; height: 72px; }
}

/* ===== 分类双行 + 分辨率选择 ===== */
.cat-rows{ display: flex; flex-direction: column; gap: 10px; }
.cats.res .cat{ font-size: 13px; }   /* 分辨率行略小作次级层级；放大/变暗效果与风格行一致 */
.res-pick{ display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.res-chip{
  cursor: pointer; font: inherit; font-size: 13px; color: rgba(255,255,255,.72);
  padding: 8px 14px; border-radius: 10px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  transition: transform .3s var(--ease), background .3s ease, color .3s ease, border-color .3s ease;
}
.res-chip:hover{ color: #fff; border-color: rgba(255,255,255,.32); transform: translateY(-1px); }
.res-chip.active{ color: #0b0b0c; background: #fff; border-color: #fff; }
.res-hint{ margin-top: 10px; font-size: 12px; color: rgba(255,255,255,.45); }
.sub-res{ margin-top: 12px; font-size: 13px; color: rgba(255,255,255,.62); text-align: center; }

/* ===== 搜索 ===== */
.search{
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  width: min(440px, 44vw); display: flex; align-items: center; gap: 9px;
  padding: 10px 16px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--panel-brd);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  transition: background .3s ease, border-color .3s ease;
}
.search:focus-within{ background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.32); }
.search svg{ opacity: .55; flex: 0 0 auto; color: var(--fg); }
.search input{ flex: 1; min-width: 0; background: none; border: none; outline: none; color: var(--fg); font: inherit; font-size: 14px; }
.search input::placeholder{ color: var(--fg-dim); }
.search-note{
  display: none; align-items: center; gap: 12px; padding: 0 34px;
  font-size: 13px; color: var(--fg-dim); text-shadow: 0 1px 12px rgba(0,0,0,.35);
}
.search-note.show{ display: flex; }
.clear-search{
  cursor: pointer; font: inherit; font-size: 12px; color: var(--fg);
  background: var(--panel); border: 1px solid var(--panel-brd);
  border-radius: 999px; padding: 4px 12px; transition: background .3s ease;
}
.clear-search:hover{ background: rgba(255,255,255,.18); }

@media (max-width: 640px){
  .search{ position: static; transform: none; order: 3; width: 100%; top: auto; left: auto; padding: 9px 14px; }
  .top-actions{ order: 2; }
  .search-note{ padding: 0 20px; }
  .brand{ order: 1; font-size: 16px; }
}

/* ===== 购买弹窗 · 作者卡片 ===== */
.author-card{
  display: flex; align-items: center; gap: 14px; cursor: pointer;
  padding-bottom: 18px; margin-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  transition: opacity .25s ease;
}
.author-card:hover{ opacity: .82; }
.avatar{
  width: 48px; height: 48px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px; color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.author-meta{ flex: 1; min-width: 0; }
.author-name{ font-size: 17px; font-weight: 700; }
.author-stats{ font-size: 12px; color: rgba(255,255,255,.6); margin-top: 3px; }
.author-link{
  flex: 0 0 auto; cursor: pointer; font: inherit; font-size: 13px; color: #fff;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px; padding: 7px 14px; transition: background .3s ease;
}
.author-link:hover{ background: rgba(255,255,255,.2); }
.dl-title{ font-size: 18px; font-weight: 700; }

/* ===== 体验细节：可点 Logo / 可点作者名 / 减弱动效 ===== */
.brand{ cursor: pointer; }
#wpCreator.creator-link{ cursor: pointer; transition: color .2s ease; }
#wpCreator.creator-link:hover{ color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce){
  *{ transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .layer{ transform: none !important; transition: opacity .25s ease !important; }
}
