/* ═══════════════════════════════════════════════
   软件小栈 · style2.css
   配色 / 卡片语言沿用 zofeel.us.ci/tvbox，扩展卡片、筛选、分页、弹窗
   ═══════════════════════════════════════════════ */
:root {
  color-scheme: dark;
  --bg: #070a12;
  --panel-border: rgba(255, 255, 255, 0.2);
  --text: #f5f7fb;
  --muted: #b4bfce;
  --dim: #8d99ac;
  --accent: #6ee7d8;
  --accent-strong: #ffcc66;
  --line: rgba(255, 255, 255, 0.14);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.36);
  /* 内容栏几何：顶栏 / hero / 卡片共用，保证左右边缘对齐 */
  --shell-w: min(1120px, calc(100% - 32px));
  --panel-pad: clamp(20px, 4vw, 32px);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  margin: 0;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 12%, rgba(110, 231, 216, 0.18), transparent 28rem),
    radial-gradient(circle at 82% 4%, rgba(255, 204, 102, 0.12), transparent 26rem),
    radial-gradient(circle at 50% 92%, rgba(99, 102, 241, 0.12), transparent 30rem),
    linear-gradient(145deg, #070a12 0%, #101725 54%, #070a12 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  content: "";
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 72%);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 72%);
}

button,
a {
  font: inherit;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  top: 0;
  left: -9999px;
  z-index: 99;
  padding: 10px 16px;
  color: #06121a;
  background: var(--accent);
  border-radius: 0 0 8px 0;
}

.skip:focus {
  left: 0;
}

/* ═══ 顶部导航 + 搜索 ═══ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 10, 18, 0.76);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  width: var(--shell-w);
  margin: 0 auto;
  padding: 12px var(--panel-pad);
}

.brand {
  display: flex;
  flex: none;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}

.brand__word {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.5px;
  white-space: nowrap;
  background: linear-gradient(115deg, var(--accent) 0%, #7fd3ff 45%, var(--accent-strong) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.search {
  position: relative;
  flex: none;
  width: 380px;
  max-width: 100%;
  margin-left: auto;
}

.search__icon {
  position: absolute;
  top: 50%;
  left: 15px;
  transform: translateY(-50%);
  color: var(--accent);
  pointer-events: none;
  filter: drop-shadow(0 0 7px rgba(110, 231, 216, 0.65));
}

.search input {
  width: 100%;
  height: 46px;
  padding: 0 44px 0 44px;
  border: 1px solid rgba(110, 231, 216, 0.45);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  background: linear-gradient(180deg, rgba(110, 231, 216, 0.12), rgba(255, 255, 255, 0.04));
  outline: none;
  -webkit-appearance: none;
  box-shadow:
    0 0 0 1px rgba(110, 231, 216, 0.12),
    0 0 24px rgba(110, 231, 216, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.search input::placeholder {
  color: rgba(180, 191, 206, 0.8);
}

.search input:focus,
.search input:focus-visible {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(110, 231, 216, 0.2), rgba(255, 255, 255, 0.05));
  box-shadow:
    0 0 0 3px rgba(110, 231, 216, 0.22),
    0 0 34px rgba(110, 231, 216, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.search kbd {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  padding: 3px 8px;
  border: 1px solid rgba(110, 231, 216, 0.4);
  border-radius: 6px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  background: rgba(110, 231, 216, 0.1);
}

/* ═══ 页面骨架 ═══ */
.page-shell {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  width: var(--shell-w);
  margin: 0 auto;
  padding: 36px 0 24px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  /* 上下内边距分开：顶部保留呼吸感，底部收紧，避免与下方区块之间出现大片空白 */
  padding: clamp(24px, 4vw, 44px) var(--panel-pad) clamp(8px, 1.6vw, 16px);
}

.hero__content,
.hero__logo {
  position: relative;
  z-index: 1;
}

.section-kicker:empty {
  display: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.08;
  letter-spacing: 0;
  text-shadow: 0 12px 34px rgba(0, 0, 0, 0.36);
}

.hero__kicker {
  margin-bottom: 14px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
}

.hero__slogan {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.7;
}

/* ═══ 首屏旋转图片 ═══ */
.hero__logo {
  display: block;
  width: clamp(72px, 10vw, 110px);
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  animation: spinClockwise 4s linear infinite;
}

@keyframes spinClockwise {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.panel {
  margin-top: 24px;
  padding: var(--panel-pad);
}

/* 首个面板紧跟 hero：不再叠加外边距，收掉多余空白 */
.hero + .panel {
  margin-top: 0;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-head h2 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: 0;
}

.section-kicker {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.section-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
}

/* ═══ 工具条：平台筛选 ═══ */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  min-height: 36px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.045);
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.chip:hover {
  border-color: rgba(110, 231, 216, 0.5);
  color: var(--text);
}

.chip.on {
  border-color: rgba(110, 231, 216, 0.72);
  color: var(--accent);
  background: rgba(110, 231, 216, 0.13);
}

.toolbar__hint {
  margin: 0;
  color: var(--dim);
  font-size: 13px;
}

/* ═══ 软件卡片 ═══ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 12px;
}

.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.app-card:hover {
  transform: translateY(-2px);
  border-color: rgba(110, 231, 216, 0.72);
  background: rgba(110, 231, 216, 0.1);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.app-card__rank {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 2px 7px;
  border: 1px solid rgba(255, 204, 102, 0.4);
  border-radius: 5px;
  color: var(--accent-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  background: rgba(255, 204, 102, 0.1);
}

.app-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-card__logo {
  width: 46px;
  height: 46px;
  flex: none;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.06);
}

.app-card__info {
  min-width: 0;
  flex: 1;
}

/* TOP 角标占位，避免压住软件名 */
.app-card.has-rank .app-card__info {
  padding-right: 52px;
}

.app-card__name {
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.app-card__desc {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.app-card__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.tag {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  white-space: nowrap;
}

.tag--version {
  border-color: rgba(110, 231, 216, 0.3);
  color: var(--accent);
  background: rgba(110, 231, 216, 0.08);
}

.tag--heat {
  border-color: rgba(255, 204, 102, 0.3);
  color: var(--accent-strong);
  background: rgba(255, 204, 102, 0.08);
}

.dl {
  flex: none;
  margin-left: auto;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(110, 231, 216, 0.4);
  border-radius: 8px;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  background: rgba(110, 231, 216, 0.1);
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.dl:hover {
  border-color: var(--accent);
  color: #06121a;
  background: var(--accent);
}

/* ═══ 空状态 / 分页 ═══ */
.empty {
  display: none;
  margin: 18px 0 0;
  padding: 34px 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--dim);
  font-size: 13.5px;
  text-align: center;
}

.empty.is-visible {
  display: block;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 22px 0 0;
}

.pager:empty {
  display: none;
}

.pg {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.045);
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.pg:hover:not([disabled]) {
  border-color: rgba(110, 231, 216, 0.5);
  color: var(--accent);
  background: rgba(110, 231, 216, 0.1);
}

.pg[aria-current="page"] {
  border-color: rgba(110, 231, 216, 0.72);
  color: var(--accent);
  font-weight: 700;
  background: rgba(110, 231, 216, 0.13);
}

.pg[disabled] {
  opacity: 0.35;
  cursor: default;
}

.pg-info {
  padding: 0 8px;
  color: var(--dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

/* ═══ 空壳接口（点击复制） ═══ */
.api-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.api-card {
  min-height: 74px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.api-card:hover,
.api-card:focus-visible {
  outline: none;
  transform: translateY(-2px);
  border-color: rgba(110, 231, 216, 0.72);
  background: rgba(110, 231, 216, 0.13);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.api-card__name {
  display: block;
  font-weight: 800;
}

/* ═══ 下载弹窗 ═══ */
.mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 8, 16, 0.76);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.mask.is-open {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 420px;
  padding: 22px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: linear-gradient(180deg, #131b2b, #0c111c);
  box-shadow: var(--shadow);
}

.modal__head {
  display: flex;
  align-items: center;
  gap: 13px;
}

.modal__logo {
  width: 54px;
  height: 54px;
  flex: none;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.06);
}

.modal__meta {
  min-width: 0;
  flex: 1;
}

.modal__meta b {
  display: block;
  overflow: hidden;
  font-size: 17px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.modal__meta small {
  display: block;
  color: var(--dim);
  font-size: 12px;
}

.modal__close {
  width: 32px;
  height: 32px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  background: transparent;
  transition: border-color 160ms ease, color 160ms ease;
}

.modal__close:hover {
  border-color: var(--line-2, rgba(255, 255, 255, 0.3));
  color: var(--text);
}

.modal__desc {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.7;
}

/* 下载地址按钮 */
.modal__link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  margin-top: 18px;
  border: 1px solid rgba(110, 231, 216, 0.45);
  border-radius: 8px;
  color: var(--accent);
  font-size: 14.5px;
  font-weight: 800;
  text-decoration: none;
  background: rgba(110, 231, 216, 0.08);
  transition: border-color 160ms ease, background 160ms ease;
}

.modal__link:hover,
.modal__link:focus-visible {
  border-color: var(--accent);
  background: rgba(110, 231, 216, 0.16);
}

/* ═══ 提示条 / 回顶 ═══ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 80;
  padding: 10px 16px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: #101217;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  background: var(--accent);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  width: 42px;
  height: 42px;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  background: rgba(16, 23, 37, 0.9);
  transition: opacity 220ms ease, transform 220ms ease;
}

.to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.site-footer {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  width: var(--shell-w);
  margin: 0 auto;
  padding: 18px 0 36px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* ═══ 响应式 ═══ */
@media (max-width: 860px) {
  :root {
    --shell-w: min(100% - 24px, 720px);
  }

  .page-shell {
    padding-top: 24px;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero__logo {
    width: 92px;
  }

  .api-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  :root {
    --panel-pad: 20px;
  }

  .topbar__inner {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px var(--panel-pad);
  }

  .search {
    order: 2;
    flex: 1 1 100%;
    width: auto;
    margin-left: 0;
  }

  .search input {
    height: 46px;
    font-size: 16px;
  }

  .search kbd {
    display: none;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .api-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 20px var(--panel-pad) 8px;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .chips {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .chip {
    min-height: 40px;
  }

  .pg {
    min-width: 40px;
    height: 40px;
  }

  .pg-info {
    flex: 1 1 100%;
    padding: 6px 0 0;
    font-size: 12px;
    text-align: center;
  }

  .to-top {
    right: 14px;
    bottom: 16px;
    width: 46px;
    height: 46px;
  }

  .toast {
    right: 16px;
    left: 16px;
    transform: translate(0, 16px);
    text-align: center;
  }

  .toast.is-visible {
    transform: translate(0, 0);
  }
}

@media (pointer: coarse) {
  .chip,
  .dl,
  .pg,
  .modal__close,
  .modal__link,
  .to-top {
    touch-action: manipulation;
  }

  .dl,
  .chip,
  .pg {
    min-height: 44px;
  }

  .modal__link {
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
