:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-dark: #1e40af;
  --accent-red: #ef4444;
  --accent-orange: #f59e0b;
  --accent-green: #10b981;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 2px 8px rgba(0,0,0,.08);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}
[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #172033;
  --border: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --primary: #60a5fa;
  --primary-hover: #93c5fd;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 2px 8px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  /* 横屏时 iOS 会自动放大字号，锁定为 100% 避免版式跳变 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
/* 图片/内嵌媒体永不撑破容器 */
img, video, iframe, embed, object { max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

.container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
}
.main { min-width: 0; }
.sidebar { display: flex; flex-direction: column; gap: 16px; }

.crumbs {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.crumbs a { color: var(--text-muted); }
.crumbs span { margin: 0 6px; opacity: .5; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.card-header {
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
/* 兜底：卡片头里的长文本宁可换行，也不要把整页撑出横向滚动 */
.card-header { flex-wrap: wrap; min-width: 0; }
.card-header > span { min-width: 0; }
.card-header .cat-icon {
  width: 6px; height: 20px;
  background: var(--primary);
  border-radius: 3px;
}
.card-header .cat-hot { background: var(--accent-red); }
.card-header .cat-tech { background: var(--accent-green); }
.card-header .cat-life { background: var(--accent-orange); }
.card-header .cat-game { background: #8b5cf6; }
.card-header .more { margin-left: auto; font-size: 12px; font-weight: 400; }

.btn {
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all .15s;
  display: inline-block;
  text-decoration: none;
  font-family: var(--font);
}
.btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }

span.tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  vertical-align: middle;
}
span.tag-pin { background: var(--accent-red); color: #fff; }
span.tag-pin-global { background: linear-gradient(90deg, #ef4444, #f97316); color: #fff; }
span.tag-hot { background: var(--accent-orange); color: #fff; }
span.tag-best { background: var(--accent-green); color: #fff; }
span.tag-new { background: var(--primary); color: #fff; }
span.tag-guest { background: #94a3b8; color: #fff; }

.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 16px;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  background: var(--surface);
  text-decoration: none;
}
.pagination a:hover, .pagination .current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

footer {
  max-width: 1200px;
  margin: 40px auto 20px;
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 12px;
  line-height: 1.8;
  margin-bottom: 8px;
}
footer .footer-links .footer-links-label { color: var(--text-faint); }
footer .footer-links a { color: var(--text-muted); text-decoration: none; }
footer .footer-links a:hover { color: var(--primary); }
footer .footer-custom { line-height: 1.8; }
footer .footer-custom + .footer-credit { margin-top: 6px; }
footer .footer-credit { color: var(--text-faint); line-height: 1.8; }
footer .footer-credit a { color: inherit; text-decoration: none; }
footer .footer-credit a:hover { color: var(--primary); }

@media (max-width: 900px) {
  .container {
    grid-template-columns: 1fr;
    margin: 12px auto;
    padding: 0 12px;
    gap: 16px;
  }
  .crumbs { margin-bottom: 10px; padding: 7px 10px; }
  .card { margin-bottom: 12px; }
  .card-header { padding: 10px 12px; }
  footer { margin-top: 28px; padding: 16px 12px; }
  /* iOS Safari 在 font-size < 16px 的输入框获得焦点时会强制缩放页面 */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="search"], input[type="url"],
  textarea, select { font-size: 16px; }
}
@media (max-width: 480px) {
  .container { padding: 0 8px; }
  .pagination { padding: 12px 8px; gap: 3px; }
  .pagination a, .pagination span { padding: 6px 10px; }
}
