/* 星际导航 · 前台右键菜单（v64） */
.nav-rm {
  position: fixed;
  z-index: 99998;
  min-width: 168px;
  max-width: 260px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--card-border, rgba(0, 0, 0, .08));
  background: var(--panel, #fff);
  box-shadow: 0 18px 48px rgba(15, 23, 42, .18), 0 2px 10px rgba(15, 23, 42, .08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transform: scale(.96) translateY(-2px);
  transform-origin: top left;
  transition: opacity .12s ease, transform .12s ease, visibility .12s;
  user-select: none;
  -webkit-user-select: none;
}
.nav-rm.on {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
}
.nav-rm-hd {
  padding: 8px 10px 7px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--card-border, rgba(0, 0, 0, .07));
}
.nav-rm-hd b {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text, #1c1f27);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-rm-hd em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 11px;
  color: var(--muted, #9aa2ae);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-rm-it {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text, #1c1f27);
  font-size: 13px;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.nav-rm-it i {
  flex: none;
  width: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--muted, #8b93a1);
  transition: color .14s ease;
}
.nav-rm-it .nav-rm-ico {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  object-fit: cover;
}
.nav-rm-it .nav-rm-emo {
  flex: none;
  width: 16px;
  text-align: center;
  font-size: 13px;
  line-height: 1;
}
.nav-rm-it span {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-rm-it:hover {
  background: var(--primary-light, rgba(99, 102, 241, .12));
  color: var(--accent, #6366f1);
}
.nav-rm-it:hover i { color: var(--accent, #6366f1); }
.nav-rm-it:active { transform: scale(.985); }
.nav-rm-sep {
  height: 1px;
  margin: 4px 8px;
  background: var(--card-border, rgba(0, 0, 0, .07));
}

/* ---------- 二级菜单（带子项的一级项：桌面悬停右侧展开 / 手机点击展开） ---------- */
.nav-rm-grp { position: relative; }
.nav-rm-arrow {
  flex: none !important;
  width: auto !important;
  margin-left: auto;
  font-size: 10px !important;
  color: var(--muted, #b3b9c4) !important;
  transition: transform .16s ease;
}
.nav-rm-grp:hover > .nav-rm-it > .nav-rm-arrow,
.nav-rm-grp.open > .nav-rm-it > .nav-rm-arrow { transform: translateX(2px); }
.nav-rm-sub {
  position: absolute;
  left: calc(100% + 6px);
  top: -6px;
  min-width: 178px;
  max-width: 260px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--card-border, rgba(0, 0, 0, .08));
  background: var(--panel, #fff);
  box-shadow: 0 18px 48px rgba(15, 23, 42, .18), 0 2px 10px rgba(15, 23, 42, .08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-3px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
}
.nav-rm.sub-left .nav-rm-sub { left: auto; right: calc(100% + 6px); transform: translateX(3px); }
.nav-rm-grp:hover > .nav-rm-sub,
.nav-rm-grp.open > .nav-rm-sub { opacity: 1; visibility: visible; transform: none; }

/* 已收藏星标：跟站点 / 文章名称同一行 */
.nav-rm-fav-mark {
  flex: none;
  margin-left: 4px;
  font-size: 11px;
  color: #f59e0b;
  vertical-align: -1px;
}
.card .name > .nav-rm-fav-mark { margin-left: 0; }

/* 已屏蔽卡片：本机隐藏 */
.nav-rm-hidden { display: none !important; }

/* 左下角屏蔽提示条 */
.nav-rm-blockbar {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 70vw;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--card-border, rgba(0, 0, 0, .08));
  background: var(--panel-solid, #fff);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .16);
  font-size: 12px;
  color: var(--muted, #8b93a1);
  cursor: pointer;
  user-select: none;
  transition: box-shadow .16s ease, transform .16s ease;
}
.nav-rm-blockbar:hover { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(15, 23, 42, .2); }
.nav-rm-blockbar i { color: #6366f1; font-size: 13px; }
.nav-rm-blockbar b {
  padding-left: 8px;
  border-left: 1px solid var(--card-border, rgba(0, 0, 0, .08));
  font-size: 12px;
  font-weight: 700;
  color: var(--accent, #6366f1);
}
@media (max-width: 640px) {
  .nav-rm-blockbar { left: 12px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); padding: 7px 11px; }
}

/* 弹窗（复制说明 / 二维码） */
.nav-rm-pop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(12, 16, 28, .46);
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, visibility .18s;
}
.nav-rm-pop.on { opacity: 1; visibility: visible; }
.nav-rm-pop-box {
  width: min(440px, 92vw);
  max-height: min(76vh, 560px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid var(--card-border, rgba(255, 255, 255, .12));
  background: var(--panel-solid, #fff);
  box-shadow: 0 24px 70px rgba(8, 12, 24, .32);
  transform: translateY(8px) scale(.98);
  transition: transform .2s cubic-bezier(.22, 1, .36, 1);
  overflow: hidden;
}
.nav-rm-pop.on .nav-rm-pop-box { transform: translateY(0) scale(1); }
.nav-rm-pop-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--card-border, rgba(0, 0, 0, .07));
}
.nav-rm-pop-hd b {
  font-size: 14px;
  color: var(--text, #1c1f27);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-rm-pop-x {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 9px;
  background: var(--surface-2, rgba(0, 0, 0, .05));
  color: var(--muted, #8b93a1);
  cursor: pointer;
}
.nav-rm-pop-x:hover { color: var(--accent, #6366f1); }
.nav-rm-pop-bd {
  padding: 16px;
  overflow: auto;
  color: var(--text-2, #5b6270);
  font-size: 13px;
  line-height: 1.75;
  word-break: break-word;
}
.nav-rm-qr .nav-rm-pop-bd { text-align: center; }
.nav-rm-qr-img {
  width: 176px;
  height: 176px;
  margin: 0 auto 10px;
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.nav-rm-qr-img img, .nav-rm-qr-img canvas { display: block; }
.nav-rm-qr p { margin: 0; font-size: 12px; color: var(--muted, #8b93a1); word-break: break-all; }

/* ---------- 富内容弹窗（渐变标题栏 + 分段 TAB + 内容区，宽屏左图右文；样式对齐后台「记一笔」弹窗） ---------- */
/* 无笼罩层：遮罩全透明，不压暗页面，仅保留居中容器与「点击外部关闭」 */
.nav-rm-rich { background: transparent; }
.nav-rm-rich-box {
  width: min(860px, 94vw);
  max-height: min(82vh, 660px);
  border: 1px solid var(--card-border, rgba(15, 23, 42, .08));
  border-radius: 20px;
  /* 棋盘格景色背景：淡蓝罩色 + 22px 方格纹理（替代纯白） */
  background:
    linear-gradient(0deg, rgba(47, 111, 224, .05), rgba(47, 111, 224, .05)),
    repeating-conic-gradient(#eef1f6 0% 25%, #f7f9fc 0% 50%) 0 0 / 22px 22px;
  box-shadow: 0 30px 80px rgba(8, 12, 24, .3), 0 6px 18px rgba(8, 12, 24, .1);
}
/* 深色模式：同款棋盘格换深色配色 */
html[data-theme="dark"] .nav-rm-rich-box {
  background:
    linear-gradient(0deg, rgba(99, 102, 241, .08), rgba(99, 102, 241, .08)),
    repeating-conic-gradient(#1a1f2b 0% 25%, #141824 0% 50%) 0 0 / 22px 22px;
}
/* 标题栏：深紫渐变 + 毛玻璃图标 + 白色标题（同后台「记一笔」弹窗头部） */
.nav-rm-rich .nav-rm-pop-hd {
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 0;
  background: linear-gradient(135deg, #5a4bb5, #37306e);
}
.nav-rm-hd-ico {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 18px;
}
.nav-rm-hd-wrap { flex: 1 1 auto; min-width: 0; }
.nav-rm-rich .nav-rm-pop-hd b {
  display: block;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.2px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-rm-rich .nav-rm-pop-hd em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 11.5px;
  color: rgba(255, 255, 255, .72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-rm-rich .nav-rm-pop-x {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .2);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background .16s ease;
}
.nav-rm-rich .nav-rm-pop-x:hover { background: #f2545b; color: #fff; }
/* TAB：白色卡片式，去灰色容器底，选中和未选中都是白色，选中用主题色描边区分 */
.nav-rm-rich-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.nav-rm-tabs {
  flex: none;
  display: flex;
  gap: 8px;
  margin: 14px 18px 0;
  padding: 0;
  border-radius: 12px;
  background: transparent;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-rm-tabs::-webkit-scrollbar { display: none; }
.nav-rm-tab {
  flex: 1 0 auto;
  min-width: 76px;
  height: 34px;
  padding: 0 16px;
  border: 1px solid var(--card-border, rgba(15, 23, 42, .07));
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  background: var(--panel-solid, #fff);
  color: var(--text-2, #5b6270);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: color .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.nav-rm-tab:hover { color: var(--accent, #6366f1); }
.nav-rm-tab.on {
  border-color: transparent;
  box-shadow: 0 0 0 1.5px rgba(99, 102, 241, .45), 0 4px 12px rgba(28, 31, 39, .08);
  color: var(--accent, #6366f1);
  font-weight: 700;
}
.nav-rm-pane { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px 22px 22px; text-align: center; }
.nav-rm-pane::-webkit-scrollbar { width: 8px; }
.nav-rm-pane::-webkit-scrollbar-thumb {
  border: 2px solid transparent; border-radius: 99px;
  background: rgba(15, 23, 42, .16); background-clip: padding-box;
}
.nav-rm-pane::-webkit-scrollbar-thumb:hover { background: rgba(15, 23, 42, .28); background-clip: padding-box; }
/* 封面图：按原始比例完整显示，圆角卡片 + 柔和投影 */
.nav-rm-cover {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: min(48vh, 400px);
  margin: 0 auto 16px;
  border-radius: 16px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 10px 28px rgba(28, 31, 39, .12), 0 0 0 1px rgba(15, 23, 42, .05);
}
.nav-rm-desc { font-size: 14px; line-height: 1.85; color: var(--text-2, #3f4654); word-break: break-word; text-align: center; }
/* 宽屏且有封面图：左图右文；左侧保留棋盘格景色，右侧文字用独立白色卡片承载并居中 */
@media (min-width: 660px) {
  .nav-rm-pane.has-cover {
    display: grid;
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
    gap: 20px; align-items: stretch; text-align: center;
    padding: 20px 22px 22px;
  }
  .nav-rm-pane.has-cover .nav-rm-cover { max-height: min(56vh, 440px); margin: 0 auto; align-self: center; }
  .nav-rm-pane.has-cover .nav-rm-desc {
    background: var(--panel-solid, #fff);
    border: 1px solid var(--card-border, rgba(15, 23, 42, .07));
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 4px 14px rgba(28, 31, 39, .05);
    text-align: center;
  }
}
.nav-rm-desc h1, .nav-rm-desc h2, .nav-rm-desc h3,
.nav-rm-desc h4, .nav-rm-desc h5, .nav-rm-desc h6 {
  margin: 14px 0 8px;
  font-weight: 800;
  line-height: 1.4;
  color: var(--text, #1c1f27);
}
.nav-rm-desc > :first-child { margin-top: 0; }
.nav-rm-desc h1 { font-size: 19px; }
.nav-rm-desc h2 { font-size: 17px; }
.nav-rm-desc h3 { font-size: 15px; }
.nav-rm-desc h4, .nav-rm-desc h5, .nav-rm-desc h6 { font-size: 13.5px; }
.nav-rm-desc p { margin: 0 0 10px; }
.nav-rm-desc p:last-child { margin-bottom: 0; }
.nav-rm-desc ul, .nav-rm-desc ol { display: inline-block; text-align: left; margin: 0 0 10px; padding-left: 20px; }
.nav-rm-desc li { margin-bottom: 4px; }
.nav-rm-desc blockquote {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-left: 3px solid rgba(99, 102, 241, .5);
  border-radius: 0 8px 8px 0;
  background: rgba(99, 102, 241, .07);
  color: var(--text-2, #5b6270);
}
.nav-rm-desc code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2, rgba(15, 23, 42, .07));
  font-size: 12px;
}
.nav-rm-desc a { color: var(--accent, #6366f1); text-decoration: none; }
.nav-rm-desc a:hover { text-decoration: underline; }
.nav-rm-desc img { max-width: 100%; height: auto; border-radius: 10px; }
.nav-rm-desc hr { margin: 14px 0; border: 0; border-top: 1px solid var(--card-border, rgba(0, 0, 0, .08)); }
.nav-rm-desc strong { color: var(--text, #1c1f27); }

@media (max-width: 640px) {
  .nav-rm { min-width: 150px; max-width: 74vw; border-radius: 16px; padding: 8px; }
  .nav-rm-it { padding: 12px 12px; font-size: 13.5px; }
  .nav-rm-pop { padding: 14px; }
  /* 手机没有悬停：二级菜单改为点击后在菜单内向下展开 */
  .nav-rm-sub {
    position: static;
    min-width: 0;
    max-width: none;
    margin: 2px 0 4px 12px;
    padding: 2px 0 2px 8px;
    border: 0;
    border-left: 2px solid var(--card-border, rgba(0, 0, 0, .1));
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    display: none;
  }
  .nav-rm-grp.open > .nav-rm-sub { display: block; }
  .nav-rm-grp:hover > .nav-rm-sub { opacity: 1; }
  .nav-rm-sub .nav-rm-it { font-size: 12.5px; padding: 9px 10px; }
  .nav-rm-rich-box { width: 100%; max-height: 86vh; }
  .nav-rm-pane { padding: 12px; }
}
