/* ============================================================
   SZB导航 · Apple 简约风
   ============================================================ */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: rgba(255, 255, 255, 0.72);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --border: rgba(0, 0, 0, 0.08);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
  --card-shadow-hover: 0 4px 6px rgba(0, 0, 0, 0.05), 0 12px 28px rgba(0, 0, 0, 0.1);
  --seg-bg: rgba(120, 120, 128, 0.12);
  --seg-active: #ffffff;
  --radius: 16px;
  --topbar-h: 52px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161617;
    --surface: #1d1d1f;
    --surface-2: rgba(22, 22, 23, 0.72);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #6e6e73;
    --accent: #2997ff;
    --accent-soft: rgba(41, 151, 255, 0.14);
    --border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --card-shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.5);
    --seg-bg: rgba(118, 118, 128, 0.24);
    --seg-active: #3a3a3c;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro SC",
    "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft); }

a { color: inherit; text-decoration: none; }

button {
  font-family: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
  padding: 0;
}

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

/* ---------------- 顶栏 ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-2);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-mark {
  width: 26px;
  height: 26px;
  display: block;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-2);
  border-radius: 980px;
  white-space: nowrap;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* 顶栏操作区：返回主站 + 语言切换 */

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.tb-home {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 980px;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.tb-home:hover { color: var(--accent); border-color: var(--accent); }

.tb-home svg { width: 14px; height: 14px; flex-shrink: 0; }

.lang-switch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--seg-bg);
  border-radius: 980px;
}

.lang-switch button {
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.2;
  color: var(--text-2);
  border-radius: 980px;
  transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.lang-switch button:hover { color: var(--text); }

.lang-switch button.active {
  background: var(--seg-active);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* ---------------- 页面主体 ---------------- */

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px 48px;
}

/* 搜索区 */

.hero {
  padding: 40px 0 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.engines {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--seg-bg);
  border-radius: 980px;
  margin-bottom: 18px;
}

.engine {
  padding: 5px 14px;
  font-size: 13px;
  color: var(--text-2);
  border-radius: 980px;
  white-space: nowrap;
  transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.engine:hover { color: var(--text); }

.engine.active {
  background: var(--seg-active);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.search-box {
  position: relative;
  width: 100%;
  max-width: 640px;
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-3);
  pointer-events: none;
}

#search {
  width: 100%;
  height: 52px;
  padding: 0 48px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  outline: none;
  box-shadow: var(--card-shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

#search::placeholder { color: var(--text-3); }

#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

#search::-webkit-search-cancel-button { display: none; }

.search-clear {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  border-radius: 50%;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.search-clear:hover { color: var(--text); background: var(--seg-bg); }

.search-clear svg { width: 12px; height: 12px; }

/* ---------------- 内容区 ---------------- */

.content-pad { padding-top: 36px; }

.section { margin-bottom: 36px; }
.section:last-child { margin-bottom: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 14px;
}

.section-title {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.section-count {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 400;
}

/* 子分类筛选 */

.subnav {
  display: flex;
  gap: 8px;
  margin: 24px 0 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.subnav::-webkit-scrollbar { display: none; }

.subpill {
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 980px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.subpill:hover { color: var(--text); border-color: var(--text-3); }

.subpill.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* 卡片网格 */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
  padding: 20px 12px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
}

.card:active { transform: translateY(-1px) scale(0.99); }

.card-logo {
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  object-fit: contain;
  border-radius: 10px;
  background: transparent;
}

.card-fallback {
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 19px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-desc {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-2);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 搜索结果 */

.result-note {
  margin: 4px 0 20px;
  font-size: 13px;
  color: var(--text-2);
}

.result-note b { color: var(--text); font-weight: 600; }

.empty {
  padding: 72px 20px;
  text-align: center;
  color: var(--text-2);
}

.empty-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--seg-bg);
}

.empty-mark svg { width: 24px; height: 24px; color: var(--text-3); }

.empty p { margin: 0 0 16px; font-size: 15px; }

.btn-clear {
  padding: 8px 22px;
  font-size: 14px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 980px;
  transition: all 0.2s ease;
}

.btn-clear:hover { background: var(--accent); color: #fff; }

/* ---------------- 页脚 ---------------- */

.footer {
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 32px;
}

.copyright {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 768px) {
  .page { padding: 0 16px 36px; }
  .topbar-inner { padding: 0 14px; gap: 8px; }
  .brand-name { display: none; }
  .brand-mark { width: 28px; height: 28px; }
  .tabs { gap: 0; }
  .tab { padding: 6px 10px; font-size: 13px; }
  .topbar-actions { gap: 6px; }
  .tb-home { padding: 6px 8px; }
  .tb-home-text { display: none; }
  .lang-switch button { padding: 4px 8px; }
  .hero { padding-top: 28px; }
  .search-box { max-width: 100%; }
  #search { height: 48px; border-radius: 14px; }
  .engines { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .engines::-webkit-scrollbar { display: none; }
  .engine { padding: 5px 12px; }
  .content-pad { padding-top: 24px; }
  .section { margin-bottom: 28px; }
  .section-title { font-size: 18px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { padding: 16px 8px 12px; border-radius: 14px; }
  .card-logo, .card-fallback { width: 40px; height: 40px; }
  .footer-inner { padding: 20px 16px 28px; }
}

@media (max-width: 360px) {
  .grid { gap: 8px; }
  .card { padding: 14px 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
