/* 云盘资源库 · 前台样式（应用商店风格） */

:root {
  --blue: #0071e3;
  --blue-d: #0077ed;
  --ink: #1d1d1f;
  --sub: #6e6e73;
  --muted: #86868b;
  --bg: #f5f5f7;
  --card: #ffffff;
  --line: #d2d2d7;
  --line-soft: #e8e8ed;
  --radius: 18px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 10px 30px rgba(0, 0, 0, .05);
  --shadow-hover: 0 4px 10px rgba(0, 0, 0, .07), 0 18px 40px rgba(0, 0, 0, .10);
  --topbar-h: 56px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 480px at 50% -120px, rgba(0, 113, 227, .06), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ============ 顶栏（仿 App Store 导航） ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; flex-shrink: 0; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue), #42a5f5);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 113, 227, .3);
}
.brand-logo svg { width: 18px; height: 18px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; letter-spacing: .2px; }
.brand-text em { font-style: normal; font-size: 11.5px; color: var(--muted); }

.status { display: inline-flex; align-items: center; gap: 6px; margin-left: 2px; font-size: 12px; color: var(--muted); flex: none; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #c7c7cc; transition: background .3s, box-shadow .3s; }
.status-txt { white-space: nowrap; }
body.is-live .status-dot { background: #34c759; box-shadow: 0 0 0 3px rgba(52, 199, 89, .18); }
body.is-live .status-txt { color: #1a7f37; }
body.is-demo .status-dot { background: #ff9f0a; box-shadow: 0 0 0 3px rgba(255, 159, 10, .18); }
body.is-demo .status-txt { color: #b2500a; }
body.is-connecting .status-dot { background: var(--blue); box-shadow: 0 0 0 3px rgba(0, 113, 227, .18); animation: statusPulse 1s ease-in-out infinite; }
@keyframes statusPulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.topbar-search {
  position: relative;
  margin-left: auto;
  flex: 1 1 auto;
  max-width: 440px;
  display: flex;
  align-items: center;
}
.search-ico {
  position: absolute; left: 13px; width: 16px; height: 16px;
  color: var(--muted); pointer-events: none;
}
#search {
  width: 100%;
  height: 38px;
  padding: 0 36px 0 38px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #e8e8ed;
  font-size: 14px;
  color: var(--ink);
  transition: background .18s, box-shadow .18s, border-color .18s;
}
#search::-webkit-search-cancel-button { display: none; }
#search:focus {
  outline: none;
  background: #fff;
  border-color: rgba(0, 113, 227, .5);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, .14);
}
#search::placeholder { color: #98989d; }
.search-clear {
  position: absolute; right: 8px;
  width: 24px; height: 24px; border: 0; border-radius: 50%;
  background: #c7c7cc; color: #fff; cursor: pointer;
  font-size: 16px; line-height: 1; display: grid; place-items: center;
}
.search-clear:hover { background: #b0b0b5; }

/* ============ 主体 ============ */
main { flex: 1 0 auto; padding-bottom: 56px; }

/* ---- 今日精选 ---- */
.feature {
  position: relative;
  margin: 26px 0;
  border-radius: 28px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .08);
  display: block;
  text-decoration: none;
  color: inherit;
  animation: cardIn .5s cubic-bezier(.2, .7, .3, 1) both;
}
.feature-media { display: block; height: 244px; overflow: hidden; background: #1d1d1f; }
.feature-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s cubic-bezier(.2, .7, .3, 1); }
.feature:hover .feature-media img { transform: scale(1.04); }
.feature-info { padding: 22px 26px 26px; }
.feature-kicker {
  display: inline-block; font-size: 12px; font-weight: 700;
  letter-spacing: .08em; color: var(--blue); text-transform: uppercase;
}
.feature-title {
  display: inline-block;
  font-size: 27px; font-weight: 800; letter-spacing: -.5px;
  margin: 8px 0 6px; color: var(--ink); text-decoration: none;
}
.feature-title:hover { color: var(--blue); }
.feature-sub { color: var(--sub); font-size: 14px; margin: 0 0 10px; }
.feature-desc { color: #333; font-size: 15px; line-height: 1.55; margin: 0 0 16px; max-width: 620px; }
.feature-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---- 热门资源横滑货架 ---- */
.shelf { margin: 26px 0; }
.shelf-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.shelf-title { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.3px; }
.shelf-sub { font-size: 13px; color: var(--muted); }
.shelf-row {
  display: flex; gap: 14px; overflow-x: auto; padding: 6px 2px 16px;
  scroll-snap-type: x mandatory; scrollbar-width: thin;
}
.shelf-row::-webkit-scrollbar { height: 6px; }
.shelf-row::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.shelf-row .app {
  background: #fff; border-radius: 18px; padding: 18px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06); min-width: 150px; scroll-snap-align: start;
}

/* ---- 分类筛选 ---- */
.cats { display: flex; flex-wrap: wrap; gap: 9px; margin: 8px 0 4px; }
.cat {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .18s;
  font-family: inherit;
}
.cat:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-1px); }
.cat.active { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.cat .cat-n { opacity: .6; margin-left: 5px; font-size: 12px; }

/* ---- 提示条 ---- */
.notice {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  background: #eef4ff;
  border: 1px solid #d4e2ff;
  color: #1f3a8a;
  display: flex; align-items: center; gap: 10px;
}
.notice::before { content: 'ℹ︎'; font-size: 15px; opacity: .85; }
.notice .notice-x { margin-left: auto; border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 18px; line-height: 1; opacity: .6; }
.notice .notice-x:hover { opacity: 1; }

/* ============ 顶部无缝循环滚动公告 ============ */
.ticker {
  position: sticky; top: var(--topbar-h); z-index: 39;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 16px;
  background: linear-gradient(90deg, rgba(0, 113, 227, .10), rgba(99, 102, 241, .08));
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
}
.ticker-flag { flex: none; font-size: 15px; line-height: 1; animation: flagPulse 2.6s ease-in-out infinite; color: var(--blue); }
.ticker-paused .ticker-track,
.ticker:active .ticker-track { animation-play-state: paused; }
@keyframes flagPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
.ticker-viewport {
  flex: 1; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3.5%, #000 96.5%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 3.5%, #000 96.5%, transparent);
}
.ticker-track {
  display: inline-flex; align-items: center;
  white-space: nowrap;
  will-change: transform;
  animation: ticker-scroll linear infinite;
  animation-duration: var(--ticker-duration, 60s);
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 3px 30px 3px 8px;
  font-size: 13.5px; color: var(--sub); line-height: 1.3;
  position: relative;
}
.ticker-item .ticker-dot { color: var(--blue); font-size: 8px; opacity: .8; }
.ticker-item::after {
  content: ''; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--line);
}
.ticker-item.has-link { cursor: pointer; color: var(--ink); font-weight: 500; }
.ticker-item.has-link:hover { color: var(--blue); }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ============ 资源网格（应用图标卡片） ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 14px 16px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  animation: cardIn .42s cubic-bezier(.2, .7, .3, 1) both;
}
.app:hover { box-shadow: var(--shadow-hover); transform: translateY(-4px); border-color: #c9c9d0; }
.app-ic {
  width: 92px; height: 92px; border-radius: 21px; overflow: hidden;
  display: block; background: #ececf0; flex: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .14);
  transition: transform .25s;
}
.app:hover .app-ic { transform: scale(1.04); }
.app-ic-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.app-body { margin-top: 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
.app-name {
  font-size: 14.5px; font-weight: 600; color: var(--ink); text-decoration: none;
  line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; max-width: 140px;
}
.app-name:hover { color: var(--blue); }
.app-sub { font-size: 12px; color: var(--sub); }
.code-chip {
  margin-top: 2px; border: 1px dashed var(--line); background: #fff; color: var(--sub);
  font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 3px 9px; border-radius: 8px; cursor: pointer; letter-spacing: .4px; transition: all .16s;
}
.code-chip:hover { border-color: var(--blue); color: var(--blue); }
.app-foot { margin-top: 9px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.app-views { font-size: 11.5px; color: var(--muted); }
.get-btn {
  background: var(--blue); color: #fff; border: 0; border-radius: 980px;
  padding: 6px 20px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, transform .1s; font-family: inherit;
}
.get-btn:hover { background: var(--blue-d); }
.get-btn:active { transform: scale(.96); }
.get-btn.lg { padding: 10px 30px; font-size: 15px; }

/* ============ 骨架屏 ============ */
.sk {
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 12px 14px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--line-soft); box-shadow: var(--shadow);
}
.sk-cover { width: 88px; height: 88px; border-radius: 21px; flex: none; }
.sk-body { margin-top: 12px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sk-line { height: 11px; border-radius: 6px; }
.sk-cover, .sk-line {
  background: linear-gradient(90deg, #e8e8ed 25%, #f0f0f3 37%, #e8e8ed 63%);
  background-size: 400% 100%;
  animation: sk 1.3s ease-in-out infinite;
}
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ============ 全部资源标题栏 ============ */
.catalog-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 32px 2px 14px; flex-wrap: wrap; }
.catalog-title { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.3px; }
.catalog-meta { font-size: 12.5px; color: var(--muted); }
.catalog-meta b { color: var(--sub); font-weight: 600; }

/* ============ 空状态 ============ */
.empty { text-align: center; padding: 64px 20px; }
.empty-ico {
  width: 92px; height: 92px; margin: 0 auto 6px;
  display: grid; place-items: center;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(0, 113, 227, .12), rgba(99, 102, 241, .12));
  color: var(--blue);
}
.empty-ico svg { width: 46px; height: 46px; opacity: .85; }
.empty-title { margin: 14px 0 6px; font-size: 16px; font-weight: 600; }
.empty-desc { margin: 0; color: var(--muted); font-size: 13.5px; }

/* ============ 页脚 ============ */
.footer {
  border-top: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, .7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.footer-inner { padding: 18px 20px; font-size: 12.5px; color: var(--muted); text-align: center; display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; }
.footer-sep { opacity: .5; }

/* ============ 轻提示 ============ */
.toast {
  position: fixed; left: 50%; bottom: 32px;
  transform: translate(-50%, 16px);
  background: rgba(29, 29, 31, .92); color: #fff;
  font-size: 13.5px; padding: 10px 20px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s;
  z-index: 90; box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ 入场动画 ============ */
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ============ 键盘可达性 ============ */
.cat:focus-visible,
.btn-primary:focus-visible,
.btn-ghost:focus-visible,
.search-clear:focus-visible,
.get-btn:focus-visible,
.ticker-item.has-link:focus-visible {
  outline: 3px solid rgba(0, 113, 227, .5);
  outline-offset: 2px;
}
.app:focus-visible { outline: 3px solid rgba(0, 113, 227, .55); outline-offset: 3px; background: #fff; border-radius: 18px; }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .feature-media { height: 200px; }
  .feature-info { padding: 18px 18px 22px; }
  .feature-title { font-size: 23px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .topbar-inner { gap: 10px; }
  .brand-text em { display: none; }
  .topbar-search { max-width: none; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .app-ic { width: 78px; height: 78px; border-radius: 18px; }
  .app-name { font-size: 13px; max-width: 100px; }
  .app { padding: 14px 8px 12px; }
  .feature-media { height: 168px; }
  .feature-title { font-size: 21px; }
  .feature-desc { font-size: 14px; }
  .shelf-row .app { min-width: 132px; }
  .cat { font-size: 12.5px; padding: 6px 13px; }
  .cats {
    flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start;
    padding-bottom: 4px; scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  }
  .cats::-webkit-scrollbar { display: none; }
  .cat { flex: none; }
  .catalog-head { margin: 26px 2px 12px; }
}
@media (max-width: 380px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
