/* ============ 五六个 5x6.net ============ */
:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --line: #e5eaf1;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-weak: #dbeafe;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 14px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.65 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef2f7; border-radius: 4px; padding: 1px 5px; font-size: .86em; }
.container { max-width: 1440px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.inline-form { display: inline; }

/* ---------- header ---------- */
.site-header {
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo-img { width: 40px; height: 40px; border-radius: 10px; display: block; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 17px; }
.brand-text small { color: var(--muted); font-size: 12px; }
/* 胶囊一体式搜索框：输入框与按钮融合在同一条圆角容器内 */
.header-search {
  flex: 1; display: flex; align-items: center; gap: 0; max-width: 420px;
  background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 999px;
  padding: 4px 4px 4px 16px;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.header-search:focus-within {
  background: #fff; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.header-search input[type="search"] {
  flex: 1 1 auto; width: auto; min-width: 0; margin-top: 0;
  border: 0; outline: none; background: transparent; box-shadow: none;
  padding: 7px 0; font-size: 14px; color: var(--text); border-radius: 0;
}
.header-search input::placeholder { color: #94a3b8; }
.header-search button {
  flex: none; border: 0; border-radius: 999px; background: var(--primary); color: #fff;
  padding: 7px 18px; font-size: 13.5px; line-height: 1.4; cursor: pointer;
  transition: background .12s;
}
.header-search button:hover { background: #1d4ed8; }
.header-nav { margin-left: auto; display: flex; align-items: center; gap: 14px; }
/* 排除按钮类（.btn-cta 自带白色文字），避免 color 冲突压过按钮配色 */
.header-nav > a:not(.btn-cta) { color: var(--text); font-size: 14.5px; }
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-name { font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 14px; cursor: pointer; line-height: 1.4;
}
.btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-cta {
  background: linear-gradient(135deg, #f97316, #ef4444); border: 1px solid transparent;
  color: #fff; font-weight: 700; box-shadow: 0 2px 10px rgba(239, 68, 68, .35);
}
.btn-cta:hover { background: linear-gradient(135deg, #ea580c, #dc2626); color: #fff; border-color: transparent; }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 6px; }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0; font: inherit; }
.linklike:hover { text-decoration: underline; }

/* ---------- flash ---------- */
.flash-area { margin-top: 14px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; font-size: 14px; }
.flash-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.flash-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ---------- sections & cards ---------- */
/* main.container：提高特异性，否则 .container 的 padding: 0 16px 会清掉顶距 */
main.container { padding: 28px 16px 48px; max-width: 1440px; width: 100%;}
.cat-section { margin-bottom: 34px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.section-head h2 { font-size: 20px; margin: 0; }
.home-h1 { font-size: 22px; margin: 0; font-weight: 750; }
.section-side { display: flex; gap: 14px; align-items: baseline; }
.cat-emoji { margin-right: 4px; }
.link-more { font-size: 14px; white-space: nowrap; }
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px;
}
/* 单栏列表（首页今日推荐 / 分类页）：主栏撑满容器 */
.card-stack { display: flex; flex-direction: column; gap: 24px; }
.card-stack .site-card { flex-direction: row; align-items: stretch; }
.card-stack .card-thumb {
  width: 240px; flex: none; margin: 0; aspect-ratio: auto; min-height: 200px;
  border-radius: var(--radius) 0 0 var(--radius);
}
.card-body { display: flex; gap: 14px; min-width: 0; }
.card-stack .card-body { flex: 1; min-width: 0; }
.card-main { flex: 1; min-width: 0; }
@media (max-width: 720px) {
  .card-stack .site-card { flex-direction: column; }
  /* width 用 auto：100% 会抵消负边距的出血效果导致缩略图偏左 */
  .card-stack .card-thumb { width: auto; aspect-ratio: 5 / 2; min-height: 0; border-radius: var(--radius) var(--radius) 0 0; margin: -14px -16px 6px; }
  .header-nav > a:not(.btn-cta) { display: none; }
  .section-side { display: none; }
}
/* 首页分类导航（现已置于页脚 footer-cats） */
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.cat-chips a {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  color: var(--text); font-size: 14px;
}
.cat-chips a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.cat-chips .chip-rank { background: var(--primary); border-color: var(--primary); color: #fff; }
.site-footer .cat-chips { justify-content: center; margin: 10px 0 4px; }
.site-footer .cat-chips a { font-size: 13px; padding: 4px 12px; }
.site-footer .cat-chips .chip-rank { color: #fff; }
.site-footer .cat-chips .chip-rank:hover { color: #fff; }
.site-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
  overflow: hidden;
}
.card-thumb {
  display: block; margin: -14px -16px 6px; aspect-ratio: 5 / 2; background: #eef2f7;
  overflow: hidden; border-radius: var(--radius) var(--radius) 0 0;
}
.card-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .2s ease;
}
.site-card:hover .card-thumb img { transform: scale(1.03); }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 650; color: var(--text); }
.card-title:hover { color: var(--primary); text-decoration: none; }
.card-favicon { border-radius: 4px; flex: none; }
.badge {
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; vertical-align: 2px;
}
.badge-pick { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.card-desc { margin: 0; color: var(--muted); font-size: 13.5px; min-height: 42px; }
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.card-cat {
  background: var(--primary-weak); color: var(--primary); border-radius: 999px; padding: 1px 9px;
  font-size: 12px; white-space: nowrap;
}

/* ---------- vote：卡片内竖排投票列（靠右突出） ---------- */
.site-card .vote-box {
  flex: none; width: 92px; display: flex; flex-direction: column; gap: 6px;
}
.vote-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 9px 10px; font-size: 14.5px; font-weight: 700;
  border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; cursor: pointer;
  color: var(--text); transition: all .12s;
}
.vote-btn.like { color: #047857; }
.vote-btn.dislike { color: #b91c1c; }
.vote-btn:hover:not(:disabled) { transform: translateY(-1px); }
.vote-btn.like:hover:not(:disabled) { border-color: #10b981; background: #ecfdf5; }
.vote-btn.dislike:hover:not(:disabled) { border-color: #ef4444; background: #fef2f2; }
.vote-btn.like.active { background: #10b981; border-color: #10b981; color: #fff; }
.vote-btn.dislike.active { background: #ef4444; border-color: #ef4444; color: #fff; }
.vote-btn.locked { opacity: .55; cursor: not-allowed; }
.vote-btn:disabled { opacity: .55; cursor: wait; }
.vote-btn.big { padding: 12px 26px; font-size: 16px; }
.site-card .net-score { text-align: center; font-size: 17px; }
.net-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.net-score.pos { color: var(--ok); }
.net-score.neg { color: var(--danger); }
.net-score.big { font-size: 22px; }
.vote-tip[hidden] { display: none !important; }
.vote-tip { width: 100%; font-size: 12.5px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.vote-hint { width: 100%; margin: 2px 0 0; font-size: 12.5px; }

/* ---------- page / tabs / tables ---------- */
.page-head h1 { margin: 6px 0 4px; font-size: 24px; }
.page-head p { margin: 0 0 16px; }
.empty { padding: 30px 0; text-align: center; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tabs a {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  color: var(--text); font-size: 14px;
}
.tabs a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.rank-table, .plain-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rank-table th, .rank-table td, .plain-table th, .plain-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle;
}
.plain-table.compact th, .plain-table.compact td { padding: 6px 8px; font-size: 13px; }
.rank-table thead th, .plain-table thead th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 13px; }
.rank-table tbody tr:last-child td, .plain-table tbody tr:last-child td { border-bottom: 0; }
.plain-table tbody tr:hover { background: #fafbfe; }
.rank-table .num, .plain-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.col-rank { width: 52px; color: var(--muted); font-weight: 600; }
.rank-medal { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 12.5px; }
.medal-1 { background: #f59e0b; } .medal-2 { background: #94a3b8; } .medal-3 { background: #b45309; }
.plain-table .actions { white-space: nowrap; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------- pagination ---------- */
.pagination { display: flex; align-items: center; gap: 6px; margin: 18px 0; flex-wrap: wrap; }
.pagination a, .pagination .current, .pagination .dots {
  padding: 5px 11px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); font-size: 13.5px; color: var(--text);
}
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .dots { border: 0; background: none; }
.pagination .total { margin-left: auto; }

/* ---------- detail ---------- */
.detail-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.detail-thumb { margin: -24px -24px 18px; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; background: #eef2f7; max-height: 340px; }
.detail-thumb img { width: 100%; height: auto; max-height: 340px; object-fit: cover; display: block; }
.detail-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.detail-favicon { border-radius: 10px; }
.detail-title-box { flex: 1; min-width: 200px; }
.detail-head h1 { margin: 0 0 4px; font-size: 24px; }
.detail-meta { display: flex; gap: 12px; align-items: center; margin: 0; flex-wrap: wrap; font-size: 13px; }
.detail-visit { margin-left: auto; }
.detail-desc { font-size: 15.5px; margin: 18px 0 6px; }
.detail-keywords { display: flex; gap: 6px; flex-wrap: wrap; }
.kw { background: #eef2f7; border-radius: 999px; padding: 2px 10px; font-size: 12.5px; color: var(--muted); }
.detail-vote { display: flex; flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.related { margin-top: 28px; }
.related h2 { font-size: 18px; }

/* ---------- forms ---------- */
.auth-box, .form-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px; margin: 24px auto;
}
.form-card { margin: 0; }
.form-card-full { max-width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.auth-box h1, .form-card h1 { margin-top: 0; font-size: 22px; }
label { display: block; margin-bottom: 14px; font-size: 14px; color: var(--text); }
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], input[type="date"], input[type="search"], input[type="file"], select, textarea {
  width: 100%; margin-top: 5px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 14px; background: #fbfcfe; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
small.muted { display: block; margin-top: 3px; }
.auth-alt { margin-top: 16px; font-size: 14px; }
.auth-alt .sep { margin: 0 8px; color: var(--line); }
.resend-form { margin-top: 10px; }
.stack-form button { margin-bottom: 8px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------- status ---------- */
.status { font-size: 12.5px; padding: 1px 9px; border-radius: 999px; white-space: nowrap; }
.st-pending { background: #fef3c7; color: #92400e; }
.st-approved { background: #ecfdf5; color: #047857; }
.st-rejected { background: #fef2f2; color: #b91c1c; }
.st-offline { background: #e2e8f0; color: #475569; }
.reject-reason { color: var(--danger); font-size: 13px; margin-top: 4px; }

/* ---------- 双栏布局：主内容 + 右侧广告栏 ---------- */
.page-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.sidebar { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 80px; }
.ad-card {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; overflow: hidden;
}
.ad-slot-tag {
  position: absolute; top: 8px; right: 8px; font-size: 10.5px; color: #94a3b8;
  background: #f1f5f9; border-radius: 4px; padding: 1px 6px; margin: 0;
}
.ad-img { width: 100%; height: auto; display: block; border-radius: 8px; }
.ad-title { margin: 10px 0 2px; font-weight: 650; font-size: 14.5px; }
.ad-text { margin: 0; color: var(--muted); font-size: 13px; }
.ad-code { overflow: hidden; }
.ad-empty { text-align: center; padding: 28px 14px; }
.ad-empty .muted { margin: 0 0 12px; }

/* ---------- footer（贴底 + 居中 + 版权） ---------- */
body:not(.admin-body) { display: flex; flex-direction: column; min-height: 100vh; }
body:not(.admin-body) > main { flex: 1 0 auto; }
.site-footer {
  border-top: 1px solid var(--line); background: var(--card); padding: 20px 0; margin-top: 20px;
  color: var(--muted); font-size: 13.5px; flex-shrink: 0; text-align: center;
}
.footer-inner p { margin: 4px 0; }
.profile-subs { margin-top: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.profile-subs h2 { margin-top: 0; font-size: 17px; }
.footer-brand { color: var(--text); font-size: 14.5px; }
.footer-nav a { color: var(--muted); }
.footer-nav a:hover { color: var(--primary); }

/* ============ admin ============ */
.admin-body { background: #eef1f6; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-side {
  width: 220px; flex: none; background: #0f172a; color: #cbd5e1; padding: 18px 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.admin-brand { display: flex; align-items: center; gap: 8px; padding: 0 18px 16px; font-weight: 700; color: #fff; }
.admin-brand .brand-logo-img.small { width: 30px; height: 30px; border-radius: 8px; }
.admin-side nav { display: flex; flex-direction: column; flex: 1; }
.admin-side nav a { color: #cbd5e1; padding: 10px 18px; font-size: 14px; }
.admin-side nav a:hover { background: #1e293b; color: #fff; text-decoration: none; }
.admin-side-foot { padding: 12px 18px 0; border-top: 1px solid #1e293b; display: flex; flex-direction: column; gap: 6px; }
.admin-side-foot .linklike { color: #cbd5e1; }
.admin-main { flex: 1; padding: 22px 26px; min-width: 0; }
.admin-main h1 { font-size: 22px; margin: 0 0 16px; }
.admin-main h2 { font-size: 16px; margin: 0 0 10px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; }
.stat-card strong { font-size: 26px; }
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card.warn strong { color: var(--danger); }
.mini-rank, .mini-list { margin: 0; padding-left: 20px; }
.mini-list { list-style: none; padding-left: 0; }
.mini-list li { padding: 4px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 8px; justify-content: space-between; }
.trend { display: flex; align-items: flex-end; gap: 10px; height: 110px; }
.trend-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.trend-bar { width: 26px; background: linear-gradient(180deg, #60a5fa, #2563eb); border-radius: 4px 4px 0 0; }
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar input, .filter-bar select { width: auto; margin-top: 0; }
.review-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.review-flex { display: flex; gap: 14px; align-items: flex-start; }
.review-thumb { flex: none; width: 180px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #f8fafc; display: block; }
.review-thumb img { width: 100%; height: auto; display: block; }
.review-main { flex: 1; min-width: 0; }
.media-grid { display: flex; gap: 20px; margin-bottom: 14px; align-items: flex-end; }
.media-preview { max-width: 200px; max-height: 120px; border: 1px solid var(--line); border-radius: 8px; display: block; }
.media-favicon { border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #f8fafc; }
.review-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 10px; }
.review-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.review-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.reject-inline { display: inline-flex; gap: 8px; align-items: center; margin-left: auto; }
.reject-inline input { width: 220px; margin-top: 0; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; }
.setting-item .setting-label { font-weight: 600; }
.inline-label { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; }
.inline-label input { width: auto; margin-top: 0; }

@media (max-width: 1100px) {
  .page-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}
@media (max-width: 900px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
  .header-search { order: 3; max-width: none; width: 100%; }
  .admin-shell { flex-direction: column; }
  .admin-side { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .admin-side nav { flex-direction: row; flex-wrap: wrap; }
  .admin-grid-2, .admin-grid-3, .review-grid, .settings-grid { grid-template-columns: 1fr; }
}
