/* 默认皮肤 v0.3.0:像素级对齐 bgrdh(OneNav onenav2 mini-sidebar 形态)。
   全部数值来自 onenav-style.css 实测 token(见 doc-20260706-skin-pixel-01 §2),手写实现。 */
:root {
  --luopan-primary: #1e73be;
  --op-body-bg: #f9f9f9;
  --op-body-fg: #282a2d;
  /* 白天侧栏 = OneNav io-grey-mode 实测:底 #f0f2f4、字 #515C6B、hover 主色 */
  --op-side-bg: #f0f2f4;
  --op-side-fg: #515C6B;
  --op-side-strong: #333;
  --op-side-hover-bg: rgba(136, 136, 136, .14);
  --op-side-split: rgba(0, 0, 0, .08);
  --op-header-h: 74px;
  --op-rail-w: 60px;
  --op-card-shadow: 0 26px 40px -24px rgba(0, 36, 100, .3);
}
[data-bs-theme="dark"] {
  --op-body-bg: #16181c;
  --op-body-fg: #c9ccd1;
  /* 夜间侧栏 = OneNav 深色形态 */
  --op-side-bg: #202225;
  --op-side-fg: #b2b8be;
  --op-side-strong: #fff;
  --op-side-hover-bg: rgba(136, 136, 136, .18);
  --op-side-split: rgba(255, 255, 255, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--op-body-bg);
  color: var(--op-body-fg);
  font: 14px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  transition: background-color .3s;
}
a { text-decoration: none; color: inherit; }
.text-primary, .link-primary { color: var(--luopan-primary) !important; }
.btn-primary {
  --bs-btn-bg: var(--luopan-primary);
  --bs-btn-border-color: var(--luopan-primary);
  --bs-btn-hover-bg: color-mix(in srgb, var(--luopan-primary) 85%, black);
  --bs-btn-hover-border-color: color-mix(in srgb, var(--luopan-primary) 85%, black);
}
.btn-outline-primary {
  --bs-btn-color: var(--luopan-primary);
  --bs-btn-border-color: var(--luopan-primary);
  --bs-btn-hover-bg: var(--luopan-primary);
  --bs-btn-hover-border-color: var(--luopan-primary);
}

/* ============ 左侧图标栏(OneNav mini-sidebar:60px,不展开) ============ */
.sidebar-inner {
  width: 100%; height: 100%;
  background: var(--op-side-bg);
  display: flex; flex-direction: column;
  transition: background-color .3s;
}
.side-logo {
  display: flex; align-items: center; justify-content: center;
  min-height: var(--op-header-h); line-height: var(--op-header-h);
  color: var(--op-side-strong);
}
.side-logo img { max-height: 40px; max-width: 40px; border-radius: 8px; }
.side-logo-text {
  width: 36px; height: 36px; line-height: 36px; text-align: center;
  background: var(--luopan-primary); color: #fff; font-weight: 700; border-radius: 8px;
}
.side-logo-name { display: none; margin-left: 10px; color: var(--op-side-strong); font-weight: 600; }
.side-tree { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; margin: 0; padding: 6px 0; scrollbar-width: none; }
.side-tree::-webkit-scrollbar { display: none; }
/* 父分类行尾箭头:整行点击 = 定位 + 展开/收起(合并动作);.open 旋转 90° */
.tree-arrow { margin-left: auto; font-size: .7rem; opacity: .6; transition: transform .25s; }
.tree-top.open .tree-arrow { transform: rotate(90deg); }
.side-tree .tree-top,
.side-tree .tree-children a,
.side-bottom a {
  display: flex; align-items: center; overflow: hidden;
  padding: 8px 10px; margin: 1.5px 8px;
  color: var(--op-side-fg); border-radius: 6px;
  white-space: nowrap; transition: all .3s;
}
.side-tree .tree-top:hover, .side-tree .tree-children a:hover, .side-bottom a:hover {
  color: var(--luopan-primary); background: var(--op-side-hover-bg);
}
.side-tree i, .side-bottom i { font-size: 1.15rem; flex: none; width: 24px; text-align: center; }
.side-tree span, .side-bottom span { margin-left: 8px; }
.side-bottom { padding-bottom: 10px; }
.tree-children { background: rgba(136, 136, 136, .05); border-radius: 6px; margin: 0 8px; }
.tree-children a { padding-left: 34px; font-size: .82rem; margin: 0 !important; }
.pop-title { display: none; }
.side-split { border-bottom: 1px solid var(--op-side-split); margin: 6px 14px; }

/* 桌面默认 60px 图标态(bgrdh mini 同款);html.side-expanded = 展开 220px */
@media (min-width: 992px) {
  .sidebar-nav {
    position: fixed; top: 0; left: 0; z-index: 1081;
    /* BS .offcanvas-lg 在 ≥lg 带 width/height:auto!important,必须同级压回 */
    width: var(--op-rail-w) !important; height: 100vh !important;
    visibility: visible !important; transform: none !important;
    transition: width .3s;
  }
  .main-content { margin-left: var(--op-rail-w); transition: margin-left .3s; }
  .page-header { left: var(--op-rail-w); transition: left .3s, background-color .3s; }
  /* mini 态隐藏文字/箭头/子级,图标居中 */
  .side-tree span, .side-bottom span, .side-logo-name, .tree-arrow, .side-tree .tree-children { display: none; }
  .side-tree .tree-top, .side-bottom a { justify-content: center; padding: 9px 0; }
  .side-tree i, .side-bottom i { width: auto; }
  /* 展开态(左上角按钮切换,localStorage 记忆) */
  html.side-expanded .sidebar-nav { width: 220px !important; }
  html.side-expanded .main-content { margin-left: 220px; }
  html.side-expanded .page-header { left: 220px; }
  html.side-expanded .side-tree span, html.side-expanded .side-bottom span,
  html.side-expanded .side-logo-name, html.side-expanded .tree-arrow { display: inline-flex; }
  html.side-expanded .side-tree .tree-children { display: block; }
  html.side-expanded .side-tree .tree-children:not(.show):not(.collapsing) { display: none; }
  html.side-expanded .side-tree .tree-top, html.side-expanded .side-bottom a { justify-content: flex-start; padding: 8px 10px; }
  html.side-expanded .side-tree i, html.side-expanded .side-bottom i { width: 24px; }

  /* mini 态 popup 子菜单改用 JS 加 .rail-pop(fixed 定位),见下方 —— 逃出 .side-tree overflow 裁剪 */
}

/* 收起态 hover 弹出的 popup:.side-tree 有 overflow,absolute 会被裁,故用 fixed(top 由 JS 按 item 位置算) */
.side-tree .tree-children.rail-pop {
  display: block !important;
  position: fixed; left: var(--op-rail-w);
  min-width: 184px; max-height: 80vh; overflow-y: auto;
  margin: 0; padding: 0 0 6px;
  background: var(--op-side-bg);
  border-radius: 0 8px 8px 0;
  box-shadow: 8px 6px 22px rgba(0, 0, 0, .22);
  z-index: 1090;
}
.side-tree .tree-children.rail-pop .pop-title {
  display: block; color: var(--op-side-strong); font-weight: 600; font-size: .875rem;
  background: var(--op-side-hover-bg); padding: 12px 16px; margin-bottom: 4px;
}
.side-tree .tree-children.rail-pop a { padding: 10px 16px; font-size: .855rem; justify-content: flex-start; }
/* mini 态 .side-tree span{display:none} 会连 popup 子项文字一起藏掉,这里在浮层里重新显示 */
.side-tree .tree-children.rail-pop a span { display: inline; margin-left: 0; }
/* 移动端:Bootstrap offcanvas 抽屉(220px,子级经箭头展开) */
.sidebar-nav.offcanvas-lg { --bs-offcanvas-width: 220px; background: var(--op-side-bg); }
@media (max-width: 991.98px) {
  .main-content { margin-left: 0; }
  .page-header { left: 0; }
}

/* ============ 固定顶栏(74px,白底特征阴影) ============ */
.page-header {
  position: fixed; top: 0; right: 0; z-index: 1030;
  height: var(--op-header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: var(--bs-body-bg);
  box-shadow: 0 0 25px 5px rgba(10, 10, 10, .05);
  transition: background-color .3s;
}
.topbar-btn { border: 0; font-size: 1.25rem; color: var(--op-body-fg); padding: 4px 8px; }
/* 顶部菜单(独立于左侧分类树;settings.top_menu 配置,部分项 hover 弹下拉)。
   不设 overflow —— 否则会裁掉向下弹出的 .top-dropdown(项少,桌面不溢出)。 */
.top-menu { display: flex; align-items: center; }
.top-item { position: relative; }
.top-item > a {
  display: flex; align-items: center; gap: 6px; height: var(--op-header-h);
  padding: 0 12px; white-space: nowrap; color: var(--op-body-fg); font-size: .9rem;
}
.top-item > a > .bi:first-child { font-size: 1rem; color: var(--luopan-primary); }
/* 图片图标(icon 值为 URL 时,_icon 模板渲染 <img>):em 单位随所在字号自适应,各处菜单通用 */
.menu-ico-img { width: 1.15em; height: 1.15em; object-fit: contain; vertical-align: -0.2em; border-radius: 3px; }
.top-item > a:hover { color: var(--luopan-primary); }
.top-caret { font-size: .62rem !important; opacity: .55; color: inherit !important; transition: transform .2s; }
.top-item.has-sub:hover .top-caret { transform: rotate(180deg); }
/* 下拉浮层(page-header 不裁剪,absolute 即可) */
.top-dropdown {
  position: absolute; top: calc(var(--op-header-h) - 10px); left: 8px;
  min-width: 170px; padding: 6px 0;
  background: var(--bs-body-bg);
  border: 1px solid var(--op-side-split); border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .14);
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .2s, transform .2s, visibility .2s; z-index: 1040;
}
.top-item.has-sub:hover > .top-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.top-dropdown a {
  display: flex; align-items: center; gap: 8px; padding: 9px 16px;
  color: var(--op-body-fg); font-size: .875rem; white-space: nowrap;
}
.top-dropdown a .bi { color: var(--luopan-primary); font-size: .95rem; }
.top-dropdown a:hover { background: var(--op-side-hover-bg); color: var(--luopan-primary); }
.top-search {
  display: flex; align-items: center; gap: 6px;
  background: rgba(128, 128, 128, .1); border-radius: 50px; padding: 6px 14px;
}
.top-search i { color: #888; font-size: .9rem; }
.top-search input { border: 0; background: transparent; outline: 0; width: 130px; font-size: .85rem; color: inherit; }

.main-content { display: flex; flex-direction: column; min-height: 100vh; }
.page-body { flex: 1 1 auto; padding: calc(var(--op-header-h) + 16px) 20px 20px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ============ 公告 / 首屏搜索区 ============ */
.announce {
  background: rgba(255, 193, 7, .12); border: 1px solid rgba(255, 193, 7, .3);
  color: #8a6d1a; border-radius: 6px; padding: 8px 14px; font-size: .82rem; margin-bottom: 16px;
}
[data-bs-theme="dark"] .announce { color: #e3c96b; }
/* 首屏搜索 banner(OneNav big-header-banner 同款):全宽铺到顶、透明顶栏叠在星空上 */
.search-hero.hero-banner {
  position: relative; overflow: hidden;
  margin: 0; border-radius: 0;
  background: #110E19; text-align: center;
  padding: calc(var(--op-header-h) + 58px) 16px 84px;
  min-height: 440px;
  display: flex; align-items: center; justify-content: center;
}
body.has-hero .page-body { padding-top: 20px; }
.hero-fx { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-inner { position: relative; z-index: 1; width: 100%; }
/* 顶栏透明态(首屏未滚动):白字浮于星空,滚动后回落白底(JS 加 body.header-bg) */
body.has-hero:not(.header-bg) .page-header { background: transparent; box-shadow: none; }
/* 只把顶级菜单项变白;下拉浮层是白底面板,其链接保持深色不受影响 */
body.has-hero:not(.header-bg) .top-item > a,
body.has-hero:not(.header-bg) .top-item > a > .bi:first-child,
body.has-hero:not(.header-bg) .topbar-btn { color: #eee; }
body.has-hero:not(.header-bg) .top-item > a:hover { color: #fff; }
body.has-hero:not(.header-bg) .top-search { background: rgba(255, 255, 255, .16); }
body.has-hero:not(.header-bg) .top-search input { color: #fff; }
body.has-hero:not(.header-bg) .top-search input::placeholder { color: rgba(255, 255, 255, .6); }
body.has-hero:not(.header-bg) .top-search i { color: rgba(255, 255, 255, .7); }
/* 分组 tab:白字 + 选中短下划线(bgrdh 同款,非胶囊) */
.hero-banner .slider-pills { background: transparent; border: 0; gap: 24px; margin-bottom: 18px; }
.hero-banner .slider-pills .nav-link {
  position: relative; height: auto; line-height: 1.7; padding: 2px;
  font-size: 15px; color: rgba(255, 255, 255, .72);
  background: transparent !important; box-shadow: none !important;
}
.hero-banner .slider-pills .nav-link:hover { color: #fff; }
.hero-banner .slider-pills .nav-link.active { color: #fff; font-weight: 600; }
.hero-banner .slider-pills .nav-link.active::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  bottom: -5px; width: 22px; height: 3px; border-radius: 2px; background: #fff;
}
.hero-search {
  background: rgba(0, 0, 0, .6) !important;
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 50px !important; box-shadow: none !important;
}
.hero-search .search-input { color: #fff; padding: 9px 20px; }
.hero-search .search-input::placeholder { color: rgba(255, 255, 255, .55); }
.hero-search .search-btn { color: rgba(255, 255, 255, .75); }
.hero-search .search-btn:hover { color: #fff; }
/* 下排引擎列表(bgrdh search-group 同款:分组切换后展示组内站点) */
.engine-list {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 2px 4px; margin: 12px 0 0; padding: 0; list-style: none;
}
.engine-list button {
  border: 0; background: transparent;
  color: rgba(255, 255, 255, .55); font-size: .8rem;
  padding: 3px 11px; border-radius: 20px; transition: .2s;
}
.engine-list button:hover { color: #fff; }
.engine-list button.active { color: #fff; background: transparent; font-weight: 600; }

/* 我的导航 / 最近使用(同区双 tab + 编辑模式 + 「+」添加卡,bgrdh 同款) */
.local-section .cards-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.local-card .url-body { padding: 8px 10px; }
.local-card .card-ico { width: 26px; height: 26px; border-radius: 50%; font-size: .8rem; }
.local-card .card-name { font-size: .85rem; font-weight: 500; }
.local-add .url-body {
  justify-content: center; cursor: pointer;
  border: 1px dashed rgba(128, 128, 128, .45);
  background: transparent; box-shadow: none;
  color: #999; font-size: 1.15rem; min-height: 44px;
}
.local-add .url-body:hover {
  transform: none; box-shadow: none;
  color: var(--luopan-primary); border-color: var(--luopan-primary);
}
.local-del {
  position: absolute; top: -7px; right: -7px; z-index: 3;
  width: 20px; height: 20px; border: 0; border-radius: 50%;
  background: #f1404b; color: #fff; font-size: 13px; line-height: 1;
  display: none; align-items: center; justify-content: center;
}
.local-section.editing .local-del { display: flex; }
.local-section.editing .local-add { display: none; }
.local-empty { padding: 18px 0; font-size: .82rem; }

.search-hero { padding: 34px 0 30px; }
.engine-tabs { justify-content: center; margin-bottom: 16px; gap: 0; }
/* 胶囊滑块 tab(slider_menu 同款):容器浅胶囊 + active 主色圆胶囊 */
.slider-pills, .slider-tab {
  display: inline-flex; list-style: none; padding: 0; margin: 0;
  background: rgba(0, 0, 0, .1); border-radius: 50px; border: 3px solid transparent;
}
[data-bs-theme="dark"] .slider-pills, [data-bs-theme="dark"] .slider-tab { background: rgba(255, 255, 255, .08); }
.slider-pills .nav-link, .slider-tab .nav-link {
  height: 28px; line-height: 28px; padding: 0 14px;
  font-size: 14px; color: #888; border: 0; border-radius: 100px;
  background: transparent; transition: .25s;
}
/* 分区 tab 与本地分区(我的导航/最近使用)统一走 28px 基准,不再放大 */
.slider-pills .nav-link:hover, .slider-tab .nav-link:hover { color: var(--luopan-primary); }
.slider-pills .nav-link.active, .slider-tab .nav-link.active {
  color: #fff; background: var(--luopan-primary);
  box-shadow: 0 5px 20px -3px color-mix(in srgb, var(--luopan-primary) 60%, transparent);
}
.search-box {
  max-width: 600px; margin: 0 auto; display: flex;
  background: #fff; border-radius: 3px;
  box-shadow: 0 3px 20px 0 rgba(0, 0, 0, .06);
}
[data-bs-theme="dark"] .search-box { background: #232529; }
.search-input {
  flex: 1 1 auto; height: 50px; padding: 12px;
  border: 0; outline: 0; background: transparent; font-size: 16px; color: inherit;
}
.search-btn {
  width: 68px; border: 0; background: transparent; color: #888;
  font-size: 1.1rem; cursor: pointer; transition: color .2s;
}
.search-btn:hover { color: var(--luopan-primary); }

/* ============ 分区与卡片(url-card 同款) ============ */
.cat-section { margin-bottom: 26px; scroll-margin-top: calc(var(--op-header-h) + 12px); }
/* 分区头两行(bgrdh 同款):标题一行,tab 胶囊条第二行——胶囊只包住 tab 本身,左对齐;超宽才横向滚动 */
.section-head { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.section-head .slider-tab { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.section-head .slider-tab::-webkit-scrollbar { display: none; }
/* 本地分区(我的导航/最近使用)头仍为单行:tab 左 + 编辑右 */
.section-head.local-head { flex-direction: row; align-items: center; gap: 14px; }
.section-head.local-head .slider-tab { width: auto; }
.section-title {
  display: flex; align-items: center; gap: 8px; margin: 0;
  font-size: 1.125rem; font-weight: 600; color: #555;
}
[data-bs-theme="dark"] .section-title { color: #aaa; }
.section-title i { font-size: 1.333rem; color: var(--luopan-primary); }
.section-title a { color: inherit; }
.section-title a:hover { color: var(--luopan-primary); }
.tab-content { width: 100%; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(226px, 1fr)); gap: 16px; }
.url-card .url-body {
  position: relative; display: flex; align-items: center; gap: 10px;
  background: var(--bs-body-bg); border-radius: 8px; padding: 12px;
  will-change: transform; transition: all .3s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}
.url-card .url-body:hover { transform: translateY(-6px); box-shadow: var(--op-card-shadow); }
.card-ico {
  flex: none; width: 40px; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(128, 128, 128, .1);
  color: var(--luopan-primary); font-weight: 700; font-size: 1.05rem; overflow: hidden;
}
.card-ico img { width: 100%; height: 100%; object-fit: contain; }
.url-info { min-width: 0; flex: 1 1 auto; overflow: hidden; padding-right: 5px; }
.card-name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .92rem; }
.card-name a { color: var(--op-body-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-desc {
  margin: 2px 0 0; font-size: .76rem; color: #888;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge-top { flex: none; background: #f1404b; color: #fff; font-size: .62rem; padding: .1em .35em; border-radius: .25rem; }
/* 直达角标:圆圈箭头(bgrdh 同款,常显淡色,hover 主色) */
.togo.card-go {
  position: absolute; top: 50%; right: 10px; transform: translateY(-50%);
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(128, 128, 128, .35); border-radius: 50%;
  color: var(--op-body-fg); font-size: .7rem;
  opacity: .45; transition: .25s; z-index: 2;
}
.url-card .url-body:hover .togo { opacity: .9; }
.togo:hover { color: var(--luopan-primary) !important; border-color: var(--luopan-primary); opacity: 1 !important; }

/* ============ 详情页 / 分类页 / 评论 ============ */
.breadcrumb { --bs-breadcrumb-margin-bottom: 0; font-size: .85rem; }
.breadcrumb a:hover { color: var(--luopan-primary); }
.card.border { background: var(--bs-body-bg); border-radius: 10px !important; border-color: rgba(128, 128, 128, .14) !important; }
.entry-head { display: flex; gap: 16px; align-items: flex-start; }
.entry-head .entry-ico {
  flex: none; width: 64px; height: 64px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 700;
  background: rgba(128, 128, 128, .1); color: var(--luopan-primary); overflow: hidden;
}
.entry-head .entry-ico img { width: 100%; height: 100%; object-fit: contain; }
.entry-meta { color: #888; font-size: .85rem; }
.entry-desc { border-top: 1px solid rgba(128, 128, 128, .15); margin-top: 18px; padding-top: 18px; }
.entry-desc h1, .entry-desc h2, .entry-desc h3 { font-size: 1.05rem; font-weight: 600; margin: 1.1em 0 .5em; }
.entry-desc img { max-width: 100%; }
#qr-box { display: flex; justify-content: center; padding: 12px; }
.comment-item { border-bottom: 1px solid rgba(128, 128, 128, .12); padding: 12px 0; }
.comment-item:last-child { border-bottom: 0; }
.comment-nick { font-weight: 600; font-size: .9rem; }
.comment-time { color: #999; font-size: .75rem; }
.page-title { font-size: 1.25rem; font-weight: 600; }

/* ============ 悬浮工具 / 页脚 / 通用 ============ */
.floating-tools { position: fixed; right: 18px; bottom: 24px; z-index: 1030; }
.tool-btn {
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bs-body-bg); color: var(--op-body-fg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .13);
}
.tool-btn:hover { color: var(--luopan-primary); }
.site-footer {
  margin-top: 10px; padding: 22px 20px 26px;
  text-align: center; color: #999; font-size: 12px;
}
.site-footer a { color: #999; }
.site-footer a:hover { color: var(--luopan-primary); }
.footer-links a + a::before {
  content: ""; display: inline-block; width: 4px; height: 4px; margin: 0 .5em;
  border-radius: 50%; background: #888; opacity: .3; vertical-align: .2em;
}
.empty-state { color: #888; text-align: center; padding: 48px 0; }
.not-found { text-align: center; padding: 70px 0; }
.not-found h1 { font-size: 64px; color: var(--luopan-primary); margin: 0; }
