/* TestFlight 资料库 —— 资料库式网格浏览，视觉参考 iosboom 的霓虹深色风。
   独立页面，不依赖主站 app.css；深浅两套主题由 [data-theme] 控制。 */

:root {
  --tf-bg: #120b2e;
  --tf-bg-2: #1a1047;
  --tf-surface: rgba(255,255,255,.045);
  --tf-surface-hi: rgba(255,255,255,.075);
  --tf-line: rgba(255,255,255,.10);
  --tf-line-hi: rgba(17,236,248,.5);
  --tf-text: #f4f2ff;
  --tf-text-2: #b9b3d6;
  --tf-text-3: #847da8;
  --tf-cyan: #11ecf8;
  --tf-green: #12f887;
  --tf-violet: #8a5cff;
  --tf-shadow: 0 20px 60px -20px rgba(0,0,0,.7);
  --tf-hover: 0 0 0 1px rgba(17,236,248,.45), 0 16px 40px -18px rgba(17,236,248,.35);
  color-scheme: dark;
}

html[data-theme="light"] {
  --tf-bg: #f5f4fb;
  --tf-bg-2: #ffffff;
  --tf-surface: rgba(26,16,71,.035);
  --tf-surface-hi: rgba(26,16,71,.07);
  --tf-line: rgba(26,16,71,.12);
  --tf-line-hi: rgba(9,150,160,.55);
  --tf-text: #1a1633;
  --tf-text-2: #5b5578;
  --tf-text-3: #8a85a3;
  --tf-cyan: #089ba5;
  --tf-green: #0a9c5c;
  --tf-violet: #6d3fd6;
  --tf-shadow: 0 14px 40px -18px rgba(26,16,71,.22);
  --tf-hover: 0 0 0 1px rgba(9,155,165,.35), 0 12px 30px -14px rgba(9,155,165,.22);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--tf-bg);
  color: var(--tf-text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  line-height: 1.5;
}
a { color: inherit; }
button, input, select { font: inherit; }

.tf-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(138,92,255,.28), transparent 70%),
    radial-gradient(760px 380px at 92% 2%, rgba(17,236,248,.16), transparent 72%),
    radial-gradient(700px 500px at 60% 100%, rgba(18,248,135,.08), transparent 70%);
}
html[data-theme="light"] .tf-glow {
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(138,92,255,.16), transparent 70%),
    radial-gradient(760px 380px at 92% 2%, rgba(17,236,248,.12), transparent 72%);
}

.tf-head {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px clamp(16px, 5vw, 56px);
  border-bottom: 1px solid var(--tf-line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--tf-bg) 72%, transparent);
}
.tf-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.tf-brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(145deg, var(--tf-cyan), var(--tf-violet)); color: #0b0620;
  box-shadow: 0 6px 20px -6px rgba(17,236,248,.6); flex: none;
}
.tf-brand-mark svg { width: 17px; height: 17px; }
.tf-brand-name { font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.tf-brand-sep { color: var(--tf-text-3); font-weight: 400; }
.tf-brand-sub { color: var(--tf-text-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf-theme {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--tf-line); background: var(--tf-surface); color: var(--tf-text-2);
  cursor: pointer; transition: .2s; flex: none;
}
.tf-theme:hover { color: var(--tf-cyan); border-color: var(--tf-line-hi); }
.tf-theme svg { width: 18px; height: 18px; }
.tf-ico-moon { display: none; }
html[data-theme="light"] .tf-ico-sun { display: none; }
html[data-theme="light"] .tf-ico-moon { display: block; }

.tf-main { position: relative; z-index: 1; max-width: 1400px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 56px) 80px; }

.tf-hero { padding: clamp(44px, 7vw, 88px) 0 30px; }
.tf-eyebrow {
  display: inline-flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--tf-cyan); margin-bottom: 20px;
}
.tf-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tf-green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tf-green) 18%, transparent); }
.tf-hero h1 { margin: 0; font-size: clamp(38px, 6vw, 72px); line-height: 1.05; font-weight: 700; letter-spacing: -.03em; }
.tf-hero h1 span {
  background: linear-gradient(100deg, var(--tf-cyan), var(--tf-green) 55%, var(--tf-violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tf-lead { margin: 18px 0 0; max-width: 640px; color: var(--tf-text-2); font-size: clamp(14px, 1.6vw, 17px); }

.tf-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.tf-stat {
  display: flex; flex-direction: column; gap: 2px; min-width: 120px;
  padding: 14px 18px; border: 1px solid var(--tf-line); border-radius: 14px;
  background: var(--tf-surface); backdrop-filter: blur(8px);
}
.tf-stat b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--tf-cyan); }
.tf-stat:nth-child(2) b { color: var(--tf-green); }
.tf-stat:nth-child(3) b { color: var(--tf-violet); }
.tf-stat span { font-size: 12px; color: var(--tf-text-3); }

.tf-search {
  display: flex; align-items: center; gap: 12px; margin-top: 28px; max-width: 620px;
  padding: 0 16px; height: 54px; border: 1px solid var(--tf-line); border-radius: 16px;
  background: var(--tf-surface); transition: .2s;
}
.tf-search:focus-within { border-color: var(--tf-line-hi); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tf-cyan) 10%, transparent); }
.tf-search svg { width: 20px; height: 20px; color: var(--tf-text-3); flex: none; }
.tf-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--tf-text); font-size: 15px; }
.tf-search input::placeholder { color: var(--tf-text-3); }
.tf-search kbd {
  font: 600 12px/1 Inter, sans-serif; padding: 5px 8px; border-radius: 6px;
  border: 1px solid var(--tf-line); color: var(--tf-text-3); background: var(--tf-surface);
}

.tf-filter { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin: 20px 0 8px; flex-wrap: wrap; }
.tf-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.tf-cat {
  padding: 8px 15px; border-radius: 999px; border: 1px solid var(--tf-line);
  background: var(--tf-surface); color: var(--tf-text-2); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: .18s; white-space: nowrap;
}
.tf-cat:hover { color: var(--tf-text); border-color: var(--tf-line-hi); }
.tf-cat.is-active { color: #0b0620; background: var(--tf-cyan); border-color: var(--tf-cyan); font-weight: 600; }
html[data-theme="light"] .tf-cat.is-active { color: #fff; }
.tf-cat small { opacity: .7; margin-left: 4px; font-size: 11px; }
.tf-sort { display: flex; align-items: center; gap: 8px; color: var(--tf-text-3); font-size: 12px; }
.tf-sort select {
  border: 1px solid var(--tf-line); background: var(--tf-surface); color: var(--tf-text-2);
  border-radius: 10px; padding: 8px 12px; font-size: 13px; cursor: pointer; outline: 0;
}
.tf-count { color: var(--tf-text-3); font-size: 13px; margin: 14px 0 18px; }

.tf-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 14px;
}
.tf-card {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 22px 14px 16px; border: 1px solid var(--tf-line); border-radius: 18px;
  background: var(--tf-surface); cursor: pointer; transition: transform .2s, box-shadow .2s, border-color .2s;
  min-width: 0; overflow: hidden;
}
.tf-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 70px;
  background: radial-gradient(ellipse at 50% -30%, color-mix(in srgb, var(--tf-violet) 34%, transparent), transparent 72%);
  pointer-events: none;
}
.tf-card:hover { transform: translateY(-4px); box-shadow: var(--tf-hover); border-color: var(--tf-line-hi); }
.tf-card-icon {
  position: relative; width: 64px; height: 64px; border-radius: 16px; object-fit: cover;
  background: var(--tf-surface-hi); border: 1px solid var(--tf-line); flex: none;
  box-shadow: var(--tf-shadow);
}
.tf-card-fallback {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 16px; flex: none;
  font-size: 26px; font-weight: 700; color: #fff; border: 1px solid var(--tf-line);
}
.tf-card-name {
  margin-top: 14px; font-size: 13px; font-weight: 600; line-height: 1.35;
  width: 100%; overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 35px;
}
.tf-card-meta { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.tf-tag { font-size: 10px; font-weight: 600; padding: 3px 9px; border-radius: 999px; letter-spacing: .02em; }
.tf-tag.cat { color: var(--tf-cyan); background: color-mix(in srgb, var(--tf-cyan) 12%, transparent); }
.tf-tag.live { color: var(--tf-green); background: color-mix(in srgb, var(--tf-green) 12%, transparent); display: inline-flex; align-items: center; gap: 5px; }
.tf-tag.live::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--tf-green); }
.tf-card-go {
  margin-top: 12px; width: 100%; padding: 8px; border-radius: 10px; border: 1px solid var(--tf-line-hi);
  background: color-mix(in srgb, var(--tf-cyan) 10%, transparent); color: var(--tf-cyan);
  font-size: 12px; font-weight: 600; cursor: pointer; transition: .18s;
}
.tf-card:hover .tf-card-go { background: var(--tf-cyan); color: #0b0620; }

.tf-empty { text-align: center; padding: 80px 20px; color: var(--tf-text-3); }
.tf-empty-mark { font-size: 48px; opacity: .5; }
.tf-empty p { margin: 12px 0 20px; }
.tf-empty button, .tf-more {
  padding: 10px 22px; border-radius: 12px; border: 1px solid var(--tf-line-hi);
  background: var(--tf-surface); color: var(--tf-cyan); font-weight: 600; cursor: pointer; transition: .2s;
}
.tf-more:hover { background: var(--tf-cyan); color: #0b0620; }
.tf-more-wrap { text-align: center; margin-top: 30px; }

.tf-foot {
  position: relative; z-index: 1; border-top: 1px solid var(--tf-line);
  padding: 30px clamp(16px, 5vw, 56px); color: var(--tf-text-3); font-size: 12px; line-height: 1.7;
  max-width: 1400px; margin: 0 auto;
}
.tf-foot p { margin: 4px 0; }
.tf-foot a { color: var(--tf-cyan); text-decoration: none; }

.tf-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.tf-modal[hidden] { display: none; }
.tf-modal-bg { position: absolute; inset: 0; background: rgba(6,3,20,.74); backdrop-filter: blur(10px); }
.tf-dialog {
  position: relative; width: min(100%, 420px); border-radius: 24px; padding: 30px;
  border: 1px solid var(--tf-line-hi); background: var(--tf-bg-2); box-shadow: 0 40px 100px -30px rgba(0,0,0,.9);
  animation: tf-pop .28s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes tf-pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.tf-dialog-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--tf-line); background: var(--tf-surface); color: var(--tf-text-2); cursor: pointer; font-size: 20px; line-height: 1; }
.tf-dialog-icon { width: 84px; height: 84px; border-radius: 20px; object-fit: cover; box-shadow: var(--tf-shadow); }
.tf-dialog h2 { margin: 18px 0 4px; font-size: 21px; font-weight: 700; line-height: 1.3; }
.tf-dialog .tf-dialog-sub { color: var(--tf-text-3); font-size: 13px; }
.tf-dialog-tags { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.tf-dialog-note { padding: 14px 16px; border-radius: 12px; background: var(--tf-surface); border: 1px solid var(--tf-line);
  color: var(--tf-text-2); font-size: 12px; line-height: 1.6; margin: 16px 0; }
.tf-dialog-go { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px;
  border-radius: 14px; border: 0; background: linear-gradient(100deg, var(--tf-cyan), var(--tf-green));
  color: #06202a; font-size: 15px; font-weight: 700; cursor: pointer; text-decoration: none; }
.tf-dialog-go svg { width: 18px; height: 18px; }

@media (max-width: 560px) {
  .tf-brand-sep, .tf-brand-sub { display: none; }
  .tf-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .tf-card { padding: 18px 10px 14px; }
  .tf-card-icon, .tf-card-fallback { width: 54px; height: 54px; }
  .tf-stat { min-width: 100px; padding: 12px 14px; }
  .tf-stat b { font-size: 20px; }
  .tf-sort { margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* iOS 聚焦 <16px 输入框会放大整页，搜索框也不能例外 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { touch-action: manipulation; }
input, textarea, select { font-size: 16px !important; }
