/* 快导航 PHP 版样式：移动优先，桌面端渐进增强 */
* { box-sizing: border-box; }
:root {
  --bg: #f6f7f9; --card: #fff; --ink: #1a1d21; --muted: #6b7280;
  --line: #e5e7eb; --brand: #2563eb; --brand-soft: #eff6ff; --fast: #e11d48;
  --topbar-bg: rgba(255,255,255,.92); --bottom-bg: rgba(255,255,255,.96);
  --announce-bg: #fffbeb; --announce-line: #fde68a;
}
/* 深色模式：变量整体切换；切换逻辑见页头先行脚本 + 页脚切换按钮 */
[data-theme="dark"] {
  --bg: #111417; --card: #1b2128; --ink: #e5e7eb; --muted: #9aa3ad;
  --line: #2b333c; --brand: #60a5fa; --brand-soft: #1e293b; --fast: #fb7185;
  --topbar-bg: rgba(27,33,40,.92); --bottom-bg: rgba(27,33,40,.96);
  --announce-bg: #2a2410; --announce-line: #57534e;
}
[data-theme="dark"] .flash-success { background: #12281a; color: #86efac; }
[data-theme="dark"] .flash-error { background: #2b1215; color: #fca5a5; }
[data-theme="dark"] dialog { background: var(--card); color: var(--ink); }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px; line-height: 1.6; padding-bottom: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* 顶栏：移动端瘦身，绝不溢出 */
.topbar { background: var(--topbar-bg); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(8px); }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 10px 14px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.logo { font-size: 20px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.logo:hover { text-decoration: none; }
.top-search { display: flex; flex: 1 1 220px; position: relative; min-width: 0; }
.top-search input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 999px 0 0 999px; font-size: 15px; outline: none;
  background: var(--card); color: var(--ink); }
.theme-btn { margin-left: auto; width: 44px; height: 44px; flex: 0 0 auto;
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  cursor: pointer; font-size: 18px; line-height: 1; }
.top-search button { padding: 9px 16px; border: 0; background: var(--brand); color: #fff;
  border-radius: 0 999px 999px 0; font-size: 15px; cursor: pointer; min-height: 44px; }
.suggest { position: absolute; top: 100%; left: 0; right: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; margin-top: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08); overflow: hidden; z-index: 30; }
.suggest a { display: block; padding: 11px 14px; color: var(--ink); }
.suggest a:hover { background: var(--brand-soft); text-decoration: none; }
.nav-desktop { display: none; }
.nav-mobile { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-mobile a { padding: 8px 14px; color: var(--ink); border-radius: 999px; min-height: 44px;
  display: inline-flex; align-items: center; }
.nav-mobile a:hover { background: var(--brand-soft); text-decoration: none; }

/* 页面 */
.page { max-width: 1080px; margin: 0 auto; padding: 16px 14px 32px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 17px; margin: 0 0 12px; }
.flash { border-radius: 12px; padding: 11px 14px; margin-bottom: 14px; background: var(--brand-soft); }
.flash-error { background: #fef2f2; color: #b91c1c; }
.flash-success { background: #f0fdf4; color: #15803d; }

/* 数据条 */
.stat-strip { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; text-align: center; }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 13px; }

/* 公告 */
.announce { background: var(--announce-bg); border: 1px solid var(--announce-line); border-radius: 12px;
  padding: 11px 14px; margin-bottom: 16px; }
.announce p { margin: 0; }

/* 站点卡片 */
.site-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.site-card { display: flex; gap: 10px; align-items: flex-start; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px; min-width: 0; }
.site-card:hover { text-decoration: none; border-color: var(--brand); }
.site-card .nm { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-card .ds { color: var(--muted); font-size: 13px; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fav-wrap { position: relative; flex: 0 0 auto; width: 36px; height: 36px; }
.fav-letter { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; border-radius: 9px; }
.fav { position: absolute; inset: 0; width: 36px; height: 36px; border-radius: 9px; }
.badge-fast { display: inline-block; background: var(--fast); color: #fff; font-size: 12px;
  padding: 1px 7px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }

/* 榜单 */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 2px;
  border-bottom: 1px solid var(--line); min-height: 44px; }
/* 社区波 · 榜单行在小屏可换行：打榜行的投票按钮、关注计数等不再把长站名推出屏幕 */
.rank-list li:last-child { border-bottom: 0; }
.rank-no { width: 22px; text-align: center; color: var(--muted); font-weight: 700; flex: 0 0 auto; }
.rank-list li:nth-child(1) .rank-no { color: #e11d48; }
.rank-list li:nth-child(2) .rank-no { color: #ea580c; }
.rank-list li:nth-child(3) .rank-no { color: #ca8a04; }
.rank-cnt { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.empty { color: var(--muted); padding: 18px 4px; text-align: center; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); min-height: 40px; display: inline-flex; align-items: center; }
.tabs a.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 详情页 */
.site-head { display: flex; gap: 14px; align-items: flex-start; }
.site-head .fav-wrap { width: 52px; height: 52px; }
.site-head .fav { width: 52px; height: 52px; }
.site-head .fav-letter { font-size: 22px; }
.site-head h1 { font-size: 22px; margin: 0; }
.tag { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; background: var(--brand-soft); color: var(--brand);
  border-radius: 999px; font-size: 13px; margin: 0 6px 6px 0; }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 11px 20px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 15px; cursor: pointer; min-height: 46px; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-block { width: 100%; font-size: 17px; font-weight: 600; }
.cta-mobile { display: block; }
.cta-desktop { display: none; }
.info-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.info-table th { text-align: left; color: var(--muted); font-weight: 400; width: 96px; padding: 8px 8px 8px 0; vertical-align: top; }
.info-table td { padding: 8px 0; word-break: break-all; }
.trend { display: flex; align-items: flex-end; gap: 4px; height: 80px; margin-top: 8px; }
/* 第一波 · 排行榜趋势箭头：点击区随榜单行（行高不小于 44px），颜色只做语义区分 */
.trend-arrow { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 24px; font-weight: 700; }
.trend-arrow.up { color: #16a34a; }
.trend-arrow.down { color: #dc2626; }
.trend-arrow.flat { color: var(--muted); }
.trend-bar { flex: 1; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.review { border-top: 1px solid var(--line); padding: 12px 0; }
.review:first-of-type { border-top: 0; }

/* 表单 */
form .field { margin-bottom: 14px; }
form label { display: block; font-weight: 600; margin-bottom: 6px; }
form input[type="text"], form input[type="password"], form input[type="url"], form input[type="email"], form input[type="date"],
form input[type="number"], form input[type="search"], form textarea, form select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; font-family: inherit; background: var(--card); color: var(--ink); }
form textarea { min-height: 120px; resize: vertical; }
.form-hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* 表格（后台） */
table.admin { width: 100%; border-collapse: collapse; font-size: 14px; }
table.admin th, table.admin td { border-bottom: 1px solid var(--line); padding: 9px 6px; text-align: left; vertical-align: top; }
table.admin td.actions { white-space: nowrap; }
.inline-form { display: inline; }
.inline-form button { padding: 6px 12px; font-size: 13px; min-height: 36px; }
/* 宽表在小屏时在容器内横向滚动，页面本身不溢出 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 广告位：无启用广告时后端不输出本节点，不留空壳 */
.ad-slot { border: 1px dashed #fbbf24; background: var(--announce-bg); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 16px; }
.ad-label { display: inline-block; font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; margin-right: 8px; }
.ad-slot p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

/* 页脚与底部导航 */
.footer { border-top: 1px solid var(--line); background: var(--card); padding: 18px 14px 90px; }
.footer-inner { max-width: 1080px; margin: 0 auto; font-size: 13px; }
.friend-links a { margin-right: 12px; }
.bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--bottom-bg); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { flex: 1; text-align: center; padding: 13px 2px; color: var(--ink); font-size: 14px; min-height: 48px; }
.bottom-nav a:hover { text-decoration: none; color: var(--brand); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }

/* 小屏：卡片内容超宽时在卡片内滚动，页面不横向溢出；后台小按钮点击区加大 */
@media (max-width: 767px) {
  .card { overflow-x: auto; }
  .inline-form button { min-height: 44px; padding: 10px 14px; }
  .tabs a { min-height: 44px; }
}

/* 收藏按钮：卡片右上角，独立于卡片链接；已收藏变红星 */
.site-card-box { position: relative; min-width: 0; }
.site-card-box .site-card { padding-right: 56px; }
.site-card-link { flex: 1; min-width: 0; }
.site-card-link:hover { text-decoration: none; }
.fav-btn, .fav-remove { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px;
  border: 0; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer;
  border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.fav-btn.on { color: var(--fast); }
.fav-remove { font-size: 22px; }
.fav-remove:hover { color: var(--fast); }
.btn-small { padding: 8px 14px; min-height: 44px; font-size: 13px; }

/* 回到顶部：移动端在底部导航之上（76px），不遮挡；桌面端贴近底部 */
.to-top { position: fixed; right: 14px; bottom: 76px; z-index: 29;
  padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer; min-height: 44px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12); font-size: 14px; }
.to-top[hidden] { display: none; }

/* 搜索页：两段标题与百度结果列表 */
.search-sec { font-size: 16px; margin: 22px 0 10px; }
.search-sec:first-of-type { margin-top: 4px; }
.baidu-list { list-style: none; margin: 0; padding: 0; }
.baidu-list li { padding: 12px 2px; border-bottom: 1px solid var(--line); }
.baidu-list li:last-child { border-bottom: 0; }


/* F 阶段 · 移动端点击区：页脚与面包屑导航链接、排行榜与百度结果链接、分页链接
   在手机宽度下也要达到 44px 点击区；宽表仍在卡片内横向滚动，页面本身不溢出 */
.friend-links a, .footer-inner p a, nav.small a { display: inline-block; padding: 12px 2px; }
.rank-list li a { display: inline-block; padding: 10px 0; }
.baidu-list li a { display: block; padding: 10px 0; }
.pager a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; }

/* 桌面端增强 */
@media (min-width: 768px) {
  .nav-desktop { display: flex; gap: 4px; margin-left: auto; }
  .nav-desktop a { padding: 8px 12px; color: var(--ink); border-radius: 999px; }
  .nav-desktop a:hover { background: var(--brand-soft); text-decoration: none; }
  .nav-mobile { display: none; }
  .bottom-nav { display: none; }
  .footer { padding-bottom: 18px; }
  .top-search { flex: 0 1 320px; }
  .site-grid { grid-template-columns: repeat(4, 1fr); }
  .stat-strip { grid-template-columns: repeat(5, 1fr); }
  .cta-mobile { display: none; }
  .cta-desktop { display: flex; }
  .detail-cols { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
  .to-top { bottom: 24px; }
}

/* 搜索增强波：知识面板布局（移动端置顶、桌面端右侧栏）、筛选条、直达卡、富摘要行 */
.search-layout { display: block; }
.search-panel { margin-bottom: 16px; }
.knowledge-card { margin-bottom: 0; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.filter-bar select { width: auto; flex: 0 1 auto; min-height: 44px; padding: 9px 10px; }
.filter-bar input[type="search"] { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; background: var(--card); color: var(--ink); }
.direct-card { border-color: #2563eb; }
.search-result { padding: 14px 2px; border-bottom: 1px solid var(--line); }
.search-result:last-of-type { border-bottom: 0; }
@media (min-width: 768px) {
  .search-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
  .search-main { grid-column: 1; grid-row: 1; min-width: 0; }
  .search-panel { grid-column: 2; grid-row: 1; margin-bottom: 0; }
}
@media (max-width: 767px) {
  .filter-bar select { flex: 1 1 120px; }
}
