/* ============================================================
   「找到了」导航站样式（原创实现，可自由修改）
   布局：顶栏（通知居中）/ 品牌搜索居中堆叠 + 快捷入口 /
         版块序号标题 + 竖向磁贴卡片墙 /
         推荐服务栏（页脚上方）/ 居中页脚 / 右侧悬浮栏
   ============================================================ */

:root {
  --bg: #f4f5f6;
  --card: #ffffff;
  --border: #e9eaec;
  --title: #2f3640;
  --text: #666f7a;
  --muted: #98a1ab;
  --primary: #3d4557;
  --accent: #ef4444;
  --accent-soft: #fdeaea;
  --green: #22c55e;
  --blue: #3b82f6;
  --shadow: 0 1px 6px rgba(15, 23, 42, .05);
  --shadow-lg: 0 8px 30px rgba(15, 23, 42, .12);
  --radius: 12px;
  --content-w: 1280px;
}

html[data-theme="dark"] {
  --bg: #1a1a2e;
  --card: #16213e;
  --border: #2a2a3a;
  --title: #e2e8f0;
  --text: #94a3b8;
  --muted: #64748b;
  --primary: #0f3460;
  --accent-soft: rgba(239, 68, 68, .16);
  --shadow: 0 1px 10px rgba(0, 0, 0, .35);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }
svg { width: 20px; height: 20px; display: block; }

/* ---------------- 顶部通知条 ---------------- */
.topbar { background: var(--primary); color: #cbd5e1; font-size: 12px; }
.topbar-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 7px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-notice {
  flex: 1;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.topbar-theme { color: #e2e8f0; display: flex; align-items: center; }
.topbar-theme svg { width: 15px; height: 15px; }
.topbar-theme:hover { color: #fff; }
.topbar-sep { opacity: .4; }
.topbar-clock { font-variant-numeric: tabular-nums; display: none; }
html[data-theme="dark"] .topbar { background: #12121f; }

/* ---------------- 品牌搜索区：居中堆叠 ---------------- */
.hero {
  padding: 30px 16px 20px;
  background:
    radial-gradient(620px 190px at 50% -40px, var(--accent-soft), transparent 70%),
    var(--bg);
}
.hero-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  width: 64px; height: 64px; border-radius: 18px; flex-shrink: 0;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff; font-size: 34px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(239, 68, 68, .35);
  user-select: none;
}
.brand-text { text-align: left; }
.brand-name { font-size: 30px; color: var(--title); letter-spacing: 2px; line-height: 1.2; }
.brand-slogan { font-size: 13px; color: var(--text); line-height: 1.6; margin-top: 2px; }
.brand-slogan-sub { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* 搜索框 */
.search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 680px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 40;
  padding: 5px 6px 5px 5px;
}
.search-engine {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px 8px 16px;
  color: var(--title); font-size: 14px; white-space: nowrap;
  border-radius: 999px;
}
.search-engine:hover { background: var(--bg); }
.engine-avatar {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.engine-name { min-width: 44px; text-align: left; }
.caret { width: 13px; height: 13px; color: var(--muted); }
.search-input {
  flex: 1; border: none; outline: none; background: none;
  padding: 10px 12px; font-size: 14px; color: var(--title); min-width: 0;
}
.search-input::placeholder { color: var(--muted); }
.search-icon {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: all .2s;
}
.search-icon svg { width: 20px; height: 20px; }
.search-icon:hover { background: var(--bg); color: var(--accent); }

.engine-panel {
  position: absolute; top: calc(100% + 10px); left: 0;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 4px;
  z-index: 50;
}
.engine-panel[hidden] { display: none; }
.engine-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--text); font-size: 13px; text-align: left;
}
.engine-opt:hover { background: var(--bg); color: var(--title); }
.engine-opt.active { color: var(--accent); font-weight: 600; }
.engine-opt .engine-avatar { flex-shrink: 0; }

/* 快捷入口：搜索下方居中一排（图标左、文字右） */
.quick {
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: 10px 26px;
}
.quick-item {
  display: flex; flex-direction: row; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text); white-space: nowrap;
  padding: 5px 14px 5px 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: all .2s;
}
.quick-item:hover {
  color: var(--accent); border-color: var(--accent);
  transform: translateY(-2px); box-shadow: var(--shadow-lg);
}
.quick-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}

/* ---------------- 推荐服务栏（页脚上方） ---------------- */
.toplinks-bar {
  background: var(--card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.toplinks-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: center; gap: 14px;
}
.toplinks { display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 4px 26px; }
.toplink {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--text); white-space: nowrap;
  padding: 3px 2px;
  transition: color .2s;
}
.toplink:hover { color: var(--accent); }
.toplink-avatar {
  width: 18px; height: 18px; border-radius: 5px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}
.toplink.is-highlight { color: var(--accent); font-weight: 600; }
.toplinks-actions { display: flex; align-items: center; gap: 8px; }
.bar-btn {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--text);
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border);
  transition: all .2s;
}
.bar-btn svg { width: 15px; height: 15px; }
.bar-btn em { font-style: normal; }
.bar-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ---------------- 版块：序号标题 + 分隔线 ---------------- */
.main { padding: 10px 16px 26px; }
.main-inner { max-width: var(--content-w); margin: 0 auto; counter-reset: sec-num; }

.section { padding: 18px 0 6px; counter-increment: sec-num; }
.section-head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px; flex-wrap: wrap;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 10px;
}
.section-title-wrap { display: flex; align-items: baseline; gap: 10px; }
.section-marker {
  font-size: 22px; font-weight: 800; line-height: 1;
  color: var(--accent);
  letter-spacing: 1px;
  flex-shrink: 0;
}
.section-marker::before { content: counter(sec-num, decimal-leading-zero); }
.section-title { font-size: 19px; color: var(--title); line-height: 1.3; letter-spacing: .5px; }
.section-desc { font-size: 12px; color: var(--muted); }

.subcats { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.subcat {
  font-size: 13px; color: var(--title);
  padding: 3px 13px; border-radius: 999px;
  transition: all .2s;
  border: 1px solid transparent;
}
.subcat:hover { color: var(--accent); }
.subcat.active {
  background: var(--accent); color: #fff; font-weight: 600;
  box-shadow: 0 2px 8px rgba(239, 68, 68, .35);
}

/* 卡片墙：首页为竖向磁贴（图标上、名称下）；子页/历史保持横向条 */
.main .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}
.main .card {
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 14px 6px 12px;
  border-radius: 12px;
}
.main .card:hover { transform: translateY(-3px); }
.main .card-avatar {
  width: 34px; height: 34px; border-radius: 10px;
  font-size: 14px;
}
.main .card-name { font-size: 12px; text-align: center; max-width: 100%; }
.main .card.is-red .card-name { color: var(--accent); }

.cardbox { position: relative; min-width: 0; }
.cardbox .card { width: 100%; }
/* 详情角标（纸飞机） */
.card-plane {
  position: absolute; top: -8px; right: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--border);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: all .18s; z-index: 4;
  box-shadow: var(--shadow);
}
.card-plane svg { width: 11px; height: 11px; }
.cardbox:hover .card-plane { opacity: 1; transform: translateY(-1px); }
.card-plane:hover { color: var(--accent); border-color: var(--accent); }
/* 本地图标 */
.card-avatar img, .engine-avatar img, .quick-avatar img, .toplink-avatar img {
  width: 70%; height: 70%; object-fit: contain; display: block;
  border-radius: 3px;
}
.card {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all .18s;
  overflow: visible;
  min-width: 0;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  z-index: 2;
}
.card-avatar {
  width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.card-name {
  font-size: 13px; color: var(--title);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card.is-red .card-name { color: var(--accent); }

/* 徽标 */
.badge {
  position: absolute; top: -8px; right: -4px;
  font-size: 10px; font-weight: 700; line-height: 1;
  padding: 3px 7px; border-radius: 999px;
  letter-spacing: .5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
  z-index: 3;
}
.badge-new { background: var(--green); color: #fff; }
.badge-app { background: #e8e8e8; color: #555; }
html[data-theme="dark"] .badge-app { background: #475569; color: #e2e8f0; }
.badge-rec { background: var(--accent); color: #fff; }

/* 副分类过滤 */
.card.hide { display: none; }
.subcat-empty {
  grid-column: 1 / -1;
  text-align: center; color: var(--muted); font-size: 13px; padding: 18px 0;
}
.subcat-empty[hidden] { display: none; }

/* ---------------- 页脚（友链居中） ---------------- */
.footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 20px 16px 26px;
}
.footer-inner { max-width: var(--content-w); margin: 0 auto; }
.fl-label { color: var(--muted); font-size: 13px; }
.friend-links { font-size: 13px; line-height: 2; text-align: center; }
.friend-links a { color: var(--text); margin-right: 14px; }
.friend-links a:hover { color: var(--accent); }
.footer-meta { margin-top: 10px; text-align: center; font-size: 12px; color: var(--muted); }
.footer-copy a { color: var(--muted); }
.footer-copy a:hover { color: var(--accent); }
.footer-sep { margin: 0 8px; opacity: .5; }
.footer-icp { margin-left: 14px; }

/* ---------------- 右侧悬浮栏 ---------------- */
.rail {
  position: fixed; right: 14px; top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 60;
}
.rail-btn {
  width: 46px; height: 46px;
  background: var(--accent); border-radius: 50%;
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(239, 68, 68, .4);
  transition: all .2s;
  position: relative;
}
.rail-btn svg { width: 20px; height: 20px; }
.rail-btn em {
  position: absolute; right: 52px; top: 50%; transform: translateY(-50%);
  font-style: normal; font-size: 12px; color: var(--title);
  background: var(--card); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 6px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .2s;
  box-shadow: var(--shadow);
}
.rail-btn:hover em { opacity: 1; }
.rail-btn.rail-top { background: var(--card); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow); }
.rail-btn.rail-top:hover { color: var(--accent); }

/* ---------------- 子页面（详情/游戏中心/AI/省钱/信息页）：标题居左、返回居右 ---------------- */
.page-head {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  flex-direction: row-reverse; justify-content: space-between;
  position: sticky; top: 0; z-index: 30;
}
.page-back {
  display: flex; align-items: center; gap: 6px;
  color: var(--text); font-size: 13px; padding: 5px 12px;
  border: 1px solid var(--border); border-radius: 999px;
  transition: all .2s;
}
.page-back:hover { color: var(--accent); border-color: var(--accent); }
.page-back svg { width: 14px; height: 14px; }
.page-title { font-size: 17px; color: var(--title); }
.page-body { max-width: var(--content-w); margin: 0 auto; padding: 20px 16px 40px; }

.detail-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
  padding: 28px; max-width: 560px; margin: 4vh auto 0;
  text-align: center;
}
.detail-icon {
  width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700;
}
.detail-icon img { width: 60%; height: 60%; object-fit: contain; }
.detail-name { font-size: 22px; color: var(--title); margin-bottom: 4px; }
.detail-crumb { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.detail-desc { font-size: 14px; color: var(--text); line-height: 1.8; margin-bottom: 20px; }
.detail-actions { display: flex; justify-content: center; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 22px; border-radius: 999px; font-size: 14px;
  border: 1px solid var(--border); color: var(--text);
  transition: all .2s;
}
.btn:hover { color: var(--accent); border-color: var(--accent); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { opacity: .88; color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  font-size: 13px; color: var(--text); padding: 4px 14px;
  border: 1px solid var(--border); border-radius: 999px;
  transition: all .2s;
}
.chip:hover { color: var(--accent); border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.item-desc { font-size: 12px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cardbox .card .card-col { display: flex; flex-direction: column; min-width: 0; }
.page-note {
  font-size: 12px; color: var(--muted); background: var(--card);
  border: 1px dashed var(--border); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 16px; line-height: 1.7;
}

/* ---------------- 弹窗 ---------------- */
.modal { position: fixed; inset: 0; z-index: 100; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); }
.modal-box {
  position: relative;
  max-width: 640px; margin: 9vh auto 0;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 78vh;
  display: flex; flex-direction: column;
}
.modal-sm { max-width: 360px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; color: var(--title); }
.modal-actions { display: flex; align-items: center; gap: 10px; }
.modal-btn { color: var(--muted); font-size: 12px; }
.modal-btn:hover { color: var(--accent); }
.modal-x {
  color: var(--muted);
  font-size: 22px; line-height: 1; padding: 0 4px;
}
.modal-x:hover { color: var(--accent); }
.modal-body { padding: 16px 18px; overflow-y: auto; }

.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.history-empty { text-align: center; color: var(--muted); padding: 24px 0; font-size: 13px; }

.qr-box { text-align: center; }
.qr-placeholder {
  width: 160px; height: 160px; margin: 4px auto 10px;
  border: 2px dashed var(--border); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px;
}
.qr-placeholder img { width: 100%; height: 100%; object-fit: contain; }
.qr-tip { font-size: 12px; color: var(--muted); line-height: 1.8; }
.qr-tip code { background: var(--bg); padding: 1px 6px; border-radius: 4px; }
.follow-qq { text-align: center; margin-top: 10px; font-size: 13px; }
.follow-qq b { color: var(--accent); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1100px) {
  .hero { padding: 24px 16px 16px; }
  .search { max-width: 640px; }
}
@media (max-width: 768px) {
  .topbar-notice { text-align: left; }
  .topbar-right { gap: 8px; }
  .toplinks-inner { flex-wrap: wrap; }
  .main .grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .section-head { gap: 8px; }
  .section-desc { display: none; }
  .brand-logo { width: 54px; height: 54px; font-size: 28px; border-radius: 15px; }
  .brand-name { font-size: 24px; }
  .rail { right: 8px; }
  .rail-btn { width: 40px; height: 40px; }
  .rail-btn em { display: none; }
  .modal-box { margin: 6vh 10px 0; }
  .engine-panel { position: fixed; top: auto; left: 10px; right: 10px; width: auto; }
}

/* ---------------- 归档文章正文（detail / info 页） ---------------- */
.detail-article {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--text);
  text-align: left;
  word-break: break-word;
}
.detail-article p { margin: 8px 0; }
.detail-article h1, .detail-article h2, .detail-article h3, .detail-article h4 {
  margin: 18px 0 8px;
  color: var(--title);
  line-height: 1.5;
}
.detail-article img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 6px 0;
  box-shadow: var(--shadow);
}
.detail-article a { color: var(--accent); word-break: break-all; }
.detail-article ul, .detail-article ol { padding-left: 22px; margin: 8px 0; }
.detail-article blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  color: var(--text);
}
.detail-article table { border-collapse: collapse; margin: 10px 0; width: 100%; }
.detail-article td, .detail-article th {
  border: 1px solid var(--border);
  padding: 6px 10px;
  font-size: 13px;
}
