/*
Theme Name: 新时代导航
Theme URI: https://example.com/newera-nav
Author: NewEra
Author URI: https://example.com
Description: 一款现代化的中文导航门户主题，紫色 Hero + 多尺寸站点卡片 + 三端适配（PC/iPad/iPhone）+ 完整后台主题设置。可在「新时代导航」顶级菜单配置招呼语、搜索引擎、热搜（支持外部 API 实时拉取）、主色、左侧分类菜单、演示数据、默认卡片尺寸、联系方式（支持 iconfont）、自定义代码。
Version: 1.4.3
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 5.6
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: navigation, portal, two-columns, custom-menu, featured-content, threaded-comments, translation-ready
Text Domain: newera-nav
*/

/* ============ 基础变量 ============ */
:root {
  --primary: #3b82f6;
  --primary-2: #2563eb;
  --primary-soft: #eaf2ff;
  --primary-3: #60a5fa;

  --text-1: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;

  --bg-page: #f5f7fb;
  --bg-card: #ffffff;
  --bg-soft: #f9fafb;
  --border-1: #e5e7eb;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-card: 0 4px 16px rgba(15, 23, 42, 0.05);
  --shadow-hover: 0 10px 24px rgba(15, 23, 42, 0.08);

  --topbar-h: 56px;
  --sidebar-w: 220px;
  --sidebar-gap: 24px;
  --content-max: 1180px;

  /* Hero 渐变（后台可改） */
  --newera-hero-1: #6e74e6;
  --newera-hero-2: #7a6cd6;
  --newera-hero-3: #6b5dd1;
}

html, body {
  height: 100%;
  background: var(--bg-page);
  color: var(--text-1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*, *::before, *::after { box-sizing: border-box; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ============ 顶部导航 ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border-1);
}
.topbar-inner {
  max-width: var(--content-max);
  height: var(--topbar-h);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.brand-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.5px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}
.brand-name { font-size: 16px; }
.nav { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; }
.nav a {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-1);
  transition: all 0.18s ease;
}
.nav a:hover { background: var(--primary-soft); color: var(--primary); }
.nav .current_page_item a,
.nav .current-menu-item a {
  background: var(--primary);
  color: #fff;
}

/* 移动汉堡 */
.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-1);
  align-items: center;
  justify-content: center;
}
.nav-toggle:hover { background: var(--bg-soft); }

/* ============ 主体布局（侧边栏为独立浮层，不影响内容居中） ============ */
.page {
  display: block;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ============ 侧边栏（fixed 浮层抽屉，展开/收起不影响主内容） ============ */
.sidebar {
  position: fixed;
  left: 0;
  top: var(--topbar-h);
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-radius: 0 16px 16px 0;
  padding: 22px 12px 16px;
  box-shadow: 4px 0 24px rgba(0,0,0,0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform 0.3s ease, opacity 0.25s ease, visibility 0.25s ease;
}
.sidebar-inner {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  transition: opacity 0.2s ease, transform 0.25s ease;
}
.sidebar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  padding: 6px 12px 14px;
  letter-spacing: 0.5px;
}
.cat-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
}
.cat-list::-webkit-scrollbar { width: 6px; }
.cat-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 3px; }

.cat-item,
.cat-list li {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cat-item a,
.cat-list li a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-1);
  font-size: 14px;
  transition: all 0.18s ease;
}
.cat-item a:hover,
.cat-list li a:hover { background: var(--primary-soft); color: var(--primary); }
.cat-list .current-menu-item a,
.cat-list .current_page_item a,
.cat-item.active a {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 500;
}
.cat-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-divider {
  height: 1px;
  background: var(--border-1);
  margin: 14px 8px 12px;
}
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin: 0 4px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.sidebar-collapse-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.sidebar-collapse-btn svg {
  transition: transform 0.3s ease;
}

/* 侧边栏开关（fixed 贴左边缘，垂直居中） */
.sidebar-toggle {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 26px;
  height: 64px;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 0 12px 12px 0;
  box-shadow: 2px 0 14px rgba(59, 130, 246, 0.4), 0 4px 10px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 55;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.sidebar-toggle svg {
  transition: transform 0.3s ease;
  transform: rotate(180deg);
}
.sidebar-toggle:hover {
  background: var(--primary-2);
  box-shadow: 2px 0 18px rgba(59, 130, 246, 0.55);
}
.page.collapsed .sidebar-toggle svg {
  transform: rotate(0deg);
}

/* 收起态：侧边栏滑出视口，主内容完全不受影响 */
.page.collapsed .sidebar {
  transform: translateX(-100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.page.collapsed .sidebar-inner {
  opacity: 0;
  transform: translateX(-16px);
}

/* ============ 主区（独立居中，与侧边栏完全解耦） ============ */
.container {
  max-width: none;
  margin: 24px 0 0;
  padding: 0;
}
.main { display: flex; flex-direction: column; gap: 28px; padding-bottom: 40px; }

/* ============ 紫色 Hero ============ */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 56px 28px 36px;
  color: #fff;
  text-align: center;
  background: linear-gradient(135deg, var(--newera-hero-1) 0%, var(--newera-hero-2) 55%, var(--newera-hero-3) 100%);
  box-shadow: 0 14px 40px rgba(110, 116, 230, 0.35);
}
.hero-bg {
  position: absolute; inset: 0;
  pointer-events: none;
}
.hero-dot {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  filter: blur(2px);
  animation: heroFloat 9s ease-in-out infinite;
}
.hero-dot.d1 { width: 60px; height: 60px; top: 14%; left: 6%; }
.hero-dot.d2 { width: 30px; height: 30px; top: 22%; right: 12%; animation-delay: 1.2s; }
.hero-dot.d3 { width: 100px; height: 100px; bottom: 10%; left: 18%; animation-delay: 2.4s; opacity: 0.6; }
.hero-dot.d4 { width: 18px; height: 18px; bottom: 22%; right: 22%; animation-delay: 3.6s; }
.hero-dot.d5 { width: 48px; height: 48px; top: 50%; right: 5%; animation-delay: 4.8s; }
@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.hero-greeting {
  position: relative;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 10px;
}
.hero-subtext {
  position: relative;
  font-size: 14px;
  opacity: 0.85;
  margin: 0 auto 26px;
  max-width: 720px;
}

/* 搜索胶囊 */
.search-pill {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 999px;
  padding: 6px 6px 6px 18px;
  max-width: 640px;
  margin: 0 auto;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
}
.search-pill-icon { color: #6b7280; flex-shrink: 0; }
.search-pill-input {
  flex: 1;
  border: 0;
  outline: 0;
  padding: 10px 12px;
  font-size: 15px;
  background: transparent;
  color: var(--text-1);
  min-width: 0;
}
.search-pill-input::placeholder { color: #9ca3af; }
.search-pill-btn {
  border: 0;
  background: linear-gradient(135deg, #4f6df6, #6b5dd1);
  color: #fff;
  border-radius: 999px;
  padding: 10px 26px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.search-pill-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(79, 109, 246, 0.4); }

/* 引擎 chips */
.engine-chips {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 18px auto 12px;
  max-width: 700px;
}
.engine-chip {
  border: 0;
  background: rgba(255,255,255,0.22);
  color: #fff;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(6px);
}
.engine-chip:hover { background: rgba(255,255,255,0.34); transform: translateY(-1px); }
.engine-chip.active {
  background: #fff;
  color: #5b4dc4;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* 热搜 */
.hot-tags {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.hot-prefix { color: rgba(255,255,255,0.7); font-size: 13px; margin-right: 4px; }
.hot-tag {
  background: rgba(255,255,255,0.16);
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  transition: all 0.2s ease;
}
.hot-tag:hover { background: rgba(255,255,255,0.34); transform: translateY(-1px); }

/* ============ 分类小节 ============ */
.cat-section { display: flex; flex-direction: column; gap: 14px; }
.cat-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
}
.cat-section-bar {
  display: inline-block;
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
}

/* ============ 卡片网格 ============ */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.featured-grid--mixed { grid-auto-flow: dense; }

/* === 大卡片 (默认) === */
.feature-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 22px 20px 36px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
  min-height: 132px;
}
.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(59, 130, 246, 0.18);
}
.feature-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}
.feature-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
}
.feature-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.feature-card .jump-btn {
  position: absolute;
  right: 12px; bottom: 12px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.feature-card:hover .jump-btn {
  background: var(--primary);
  color: #fff;
  transform: translate(2px, -2px) scale(1.08);
}

/* === 中卡片（按图复刻） === */
.feature-card--md {
  padding: 18px 18px 18px;
  min-height: 96px;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.feature-md-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.feature-md-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  display: block;
  margin-bottom: 2px;
}
.feature-md-desc {
  font-size: 12px;
  color: var(--text-2);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.feature-card--md:hover {
  border-color: rgba(59, 130, 246, 0.18);
}

/* === 小卡片（按图复刻：横向单行） === */
.feature-card--sm {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  min-height: 48px;
}
.feature-sm-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.feature-sm-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  flex-shrink: 0;
  margin-right: 6px;
}
.feature-sm-desc {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.feature-card--sm:hover {
  border-color: rgba(59, 130, 246, 0.18);
}

/* 中/小卡片也提供“立即跳转”按钮（行尾内联，避免与文字重叠；始终高亮，确保一眼可见） */
.feature-card--md .jump-btn,
.feature-card--sm .jump-btn {
  position: static;
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
  transform: none;
  transition: all 0.2s ease;
  cursor: pointer;
}
.feature-card--md:hover .jump-btn,
.feature-card--sm:hover .jump-btn {
  background: var(--primary-2);
  transform: scale(1.08);
}

/* 卡片在混合网格中：小卡片跨多列 */
.feature-card--lg { grid-column: span 1; }
.feature-card--md { grid-column: span 2; }
.feature-card--sm { grid-column: span 2; }

/* ============ 归档/搜索 ============ */
.archive-head {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  margin-top: 8px;
}
.archive-sub { color: var(--text-2); padding: 12px 0; }
.search-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.search-row { display: flex; gap: 10px; }
.search-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-1);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  background: var(--bg-soft);
}
.search-input:focus { border-color: var(--primary); background: #fff; }
.search-btn {
  border: 0;
  background: var(--primary);
  color: #fff;
  padding: 0 22px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
}
.search-btn:hover { background: var(--primary-2); }

/* ============ 右下角悬浮 ============ */
.floating-share {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.fab-theme,
.fab-main {
  position: relative;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(59, 130, 246, 0.4);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fab-theme:hover, .fab-main:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 26px rgba(59, 130, 246, 0.5);
}
.fab-theme .icon-moon,
.fab-theme .icon-sun,
.fab-main .icon-chat,
.fab-main .icon-close { transition: all 0.25s ease; }
.fab-theme .icon-sun { position: absolute; opacity: 0; transform: scale(0.5) rotate(-45deg); }
.fab-main .icon-close { position: absolute; opacity: 0; transform: rotate(-90deg) scale(0.5); }
html.dark .fab-theme .icon-moon { opacity: 0; transform: scale(0.5) rotate(45deg); }
html.dark .fab-theme .icon-sun  { opacity: 1; transform: scale(1) rotate(0deg); }
.floating-share.open .fab-main .icon-chat { opacity: 0; transform: rotate(90deg) scale(0.5); }
.floating-share.open .fab-main .icon-close { opacity: 1; transform: rotate(0deg) scale(1); }

.share-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.25s ease;
}
.floating-share.open .share-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.share-item {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s ease;
}
/* 动态数量：打开时所有联系项都淡入（错峰延迟由内联 style 提供） */
.floating-share.open .share-item { opacity: 1; transform: translateY(0); }

.share-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
  transition: all 0.2s ease;
}
.share-btn:hover { transform: translateY(-2px) scale(1.08); }
.share-btn.instagram { background: linear-gradient(135deg, #f09433, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888); }
.share-btn.twitter   { background: #000; }
.share-btn.github    { background: #24292e; }
/* 后台可新增的联系方式按钮：统一用主题蓝，支持 iconfont / Emoji */
.share-btn.contact-btn { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.iconfont {
  font-family: "iconfont" !important;
  font-style: normal;
  font-weight: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.share-btn.contact-btn .iconfont {
  font-size: 22px;
  line-height: 1;
  color: #fff;
}

.tooltip {
  background: #fff;
  color: var(--text-1);
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(8px);
  pointer-events: none;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.share-item:hover .tooltip { opacity: 1; transform: translateX(0); }
.tooltip .avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============ 页脚 ============ */
.site-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  padding: 20px 12px 36px;
}

/* ============ 三端适配 ============ */

/* iPad / 平板（768–1099px） */
@media (max-width: 1099px) {
  :root { --sidebar-w: 200px; }
  .topbar-inner { max-width: 100%; }
  .container { padding: 0 18px; }
  .featured-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { padding: 48px 24px 32px; }
  .hero-greeting { font-size: 32px; }
}

/* iPad mini / 中型 (640–767px) */
@media (max-width: 767px) {
  :root { --sidebar-w: 0; --sidebar-gap: 0; }
  .nav { display: none; }
  .nav-toggle { display: flex; }
  .nav.open {
    display: flex;
    position: absolute;
    top: var(--topbar-h);
    left: 0; right: 0;
    background: #fff;
    border-bottom: 1px solid var(--border-1);
    flex-direction: column;
    padding: 10px 16px;
    gap: 4px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  }
  .nav.open li { width: 100%; }
  .nav.open a { display: block; border-radius: 10px; padding: 12px 14px; }

  .page { padding: 0 12px 80px; }
  .sidebar {
    position: fixed;
    left: 0; top: var(--topbar-h); bottom: 0;
    transform: none !important;
    width: 100%;
    max-width: 320px;
    margin: 0;
    padding: 12px;
    border-radius: 0 16px 16px 0;
    overflow: visible;
  }
  .page.collapsed .sidebar { transform: translateX(-100%) !important; }
  .sidebar-collapse-btn, .sidebar-toggle { display: none; }
  .sidebar-inner { opacity: 1 !important; transform: none !important; pointer-events: auto; }

  /* 移动端：右侧抽屉同样作为浮层，默认隐藏，打开才滑入 */
  .sidebar--right { left: auto; right: 0; transform: translateX(100%) !important; width: 100%; max-width: 320px; }
  .page.right-open .sidebar--right { transform: translateX(0) !important; }

  .container { margin: 12px 0 0; padding: 0; }
  .hero { padding: 36px 18px 24px; border-radius: 16px; }
  .hero-greeting { font-size: 26px; }
  .hero-subtext { font-size: 13px; }
  .search-pill { padding: 5px; }
  .search-pill-btn { padding: 9px 18px; }
  .featured-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .feature-card { padding: 16px 14px 30px; min-height: 116px; }
  .feature-card--md, .feature-card--sm { grid-column: span 2; }
  .floating-share { right: 14px; bottom: 14px; gap: 10px; }
  .fab-theme, .fab-main { width: 48px; height: 48px; }
  .share-btn { width: 40px; height: 40px; }
}

/* iPhone / 小屏 (≤ 479px) */
@media (max-width: 479px) {
  .topbar-inner { padding: 0 12px; }
  .brand-name { display: none; }
  .featured-grid { grid-template-columns: 1fr; }
  .feature-card { padding: 14px 14px 26px; min-height: 100px; }
  .feature-card--md, .feature-card--sm { grid-column: span 1; }
  .hero { padding: 30px 14px 22px; }
  .hero-greeting { font-size: 22px; }
  .search-pill-input { font-size: 14px; padding: 9px 10px; }
  .search-pill-btn { padding: 8px 14px; font-size: 13px; }
  .engine-chip, .hot-tag { padding: 6px 12px; font-size: 12px; }
  .fab-theme, .fab-main { width: 44px; height: 44px; }
  .share-btn { width: 38px; height: 38px; }
}

/* ============ 深色模式 ============ */
html.dark {
  --text-1: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --bg-page: #0f172a;
  --bg-card: #1e293b;
  --bg-soft: #1e2a3e;
  --border-1: #334155;
  --primary-soft: rgba(96, 165, 250, 0.16);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 10px 26px rgba(0, 0, 0, 0.5);
}
html.dark body { background: var(--bg-page); color: var(--text-1); }
html.dark .topbar { background: rgba(15, 23, 42, 0.85); border-bottom-color: var(--border-1); }
html.dark .brand-logo { box-shadow: 0 4px 12px rgba(96, 165, 250, 0.45); }
html.dark .feature-card,
html.dark .sidebar,
html.dark .tooltip,
html.dark .search-input,
html.dark .search-card {
  background: var(--bg-card);
  color: var(--text-1);
  border-color: var(--border-1);
}
html.dark .feature-icon { background: var(--primary-soft); }
html.dark .nav a:hover { background: var(--primary-soft); }
html.dark .hero { box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5); }
html.dark .feature-md-desc,
html.dark .feature-sm-desc { color: var(--text-2); }
html.dark .search-pill { background: rgba(255,255,255,0.92); }
html.dark .search-pill-btn { background: linear-gradient(135deg, #6b5dd1, #6e74e6); }
html.dark .fab-theme,
html.dark .fab-main { background: var(--primary-3); }
html.dark .cat-section-bar { background: linear-gradient(180deg, var(--primary-3), var(--primary)); }
html.dark .sidebar-collapse-btn,
html.dark .sidebar-title { color: var(--text-2); }

/* 全局过渡 */
.hero, .topbar, .sidebar, .feature-card, .cat-section-title,
.search-pill, .engine-chip, .hot-tag, .share-btn, .tooltip,
.fab-main, .fab-theme, .sidebar-toggle, .sidebar-collapse-btn {
  transition: background-color 0.3s ease, color 0.3s ease,
              border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ============ 左 / 右 / 底 导航菜单 ============ */
.sidebar--right {
  left: auto;
  right: 0;
  border-radius: 16px 0 0 16px;
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s ease, opacity 0.25s ease, visibility 0.25s ease;
}
.page.right-open .sidebar--right {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
}
.sidebar-toggle--right {
  left: auto;
  right: 0;
  border-radius: 12px 0 0 16px;
}
.sidebar-toggle--right svg { transform: rotate(0deg); }
.page.right-open .sidebar-toggle--right svg { transform: rotate(180deg); }
.sidebar-empty { font-size: 12px; color: var(--text-3); padding: 6px 12px; margin: 0; }

.sidebar-left-nav { margin: 0; }
.sidebar-left-nav .cat-list li a { color: var(--text-2); }
.sidebar-left-nav .cat-list li a:hover { color: var(--primary); }

.footer-nav { margin-bottom: 10px; }
.footer-nav-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  margin: 0;
  padding: 0;
}
.footer-nav-list a { color: var(--text-2); font-size: 13px; }
.footer-nav-list a:hover { color: var(--primary); }

/* 空状态（无网站时） */
.newera-empty-state {
  text-align: center;
  padding: 48px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.newera-empty-icon { font-size: 42px; margin-bottom: 10px; }
.newera-empty-title { font-size: 18px; font-weight: 700; color: var(--text-1); margin: 0 0 6px; }
.newera-empty-desc { font-size: 13px; color: var(--text-2); margin: 0 0 16px; }
.newera-empty-btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}
.newera-empty-btn:hover { color: #fff; transform: translateY(-1px); }
.newera-empty-link {
  display: inline-block;
  margin-top: 2px;
  padding: 9px 20px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all .2s ease;
}
.newera-empty-link:hover { background: var(--primary); color: #fff; transform: translateY(-1px); }

/* 站点卡片 favicon 图片 */
.feature-icon-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
  flex-shrink: 0;
}
.feature-md-icon.feature-icon-img,
.feature-sm-icon.feature-icon-img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}
.feature-card:hover .feature-icon-img { transform: scale(1.05); }

/* 单篇文章 / 网站详情页 */
.newera-article {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.newera-article-header { margin-bottom: 22px; }
.newera-article-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 10px;
  line-height: 1.35;
}
.newera-article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 13px;
  color: var(--text-2);
}
.newera-article-meta a { color: var(--primary); }
.newera-article-meta a:hover { text-decoration: underline; }
.newera-article-thumb { margin: 0 0 22px; border-radius: var(--radius); overflow: hidden; }
.newera-article-thumb img { width: 100%; height: auto; display: block; }
.newera-article-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-1);
}
.newera-article-content p { margin: 0 0 16px; }
.newera-article-content h2,
.newera-article-content h3,
.newera-article-content h4 { margin: 24px 0 12px; color: var(--text-1); }
.newera-article-content img { max-width: 100%; height: auto; border-radius: var(--radius); }
.newera-article-content a { color: var(--primary); text-decoration: underline; }
.newera-article-tags { margin: 24px 0 8px; }
.newera-article-tags a {
  display: inline-block;
  padding: 5px 12px;
  margin: 0 8px 8px 0;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  font-size: 12px;
  text-decoration: none;
}
.newera-article-tags a:hover { background: var(--primary); color: #fff; }
.newera-article-footer { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }
.newera-article-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all .2s ease;
}
.newera-article-back:hover { background: var(--primary); color: #fff; }
.newera-article-back svg { transition: transform .2s ease; }
.newera-article-back:hover svg { transform: translateX(-3px); }

/* 文章归档 / 分类列表 */
.newera-article-list { display: grid; gap: 16px; }
.newera-article-item {
  padding: 20px 22px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: transform .2s ease, box-shadow .2s ease;
}
.newera-article-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.newera-article-item-title { margin: 0 0 8px; font-size: 17px; font-weight: 600; }
.newera-article-item-title a { color: var(--text-1); text-decoration: none; }
.newera-article-item-title a:hover { color: var(--primary); }
.newera-article-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 10px;
}
.newera-article-item-meta a { color: var(--primary); }
.newera-article-item-excerpt {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.newera-pagination { margin-top: 28px; }
.newera-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  margin: 0 4px 4px 0;
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-1);
  font-size: 13px;
  text-decoration: none;
  box-shadow: var(--shadow-card);
}
.newera-pagination .page-numbers.current { background: var(--primary); color: #fff; }
.newera-pagination .page-numbers:hover:not(.current) { background: var(--primary-soft); color: var(--primary); }
