/* 固定顶栏：写在页面里，换页时原地不动，支持中/英/越三语自适应排版 */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: m-leave .12s ease-out both; }
  ::view-transition-new(root) { animation: m-enter .18s ease-out both; }
  ::view-transition-old(sitenav) { display: none; }
  ::view-transition-new(sitenav) { animation: none; }
}
@keyframes m-leave { to { opacity: 0; } }
@keyframes m-enter { from { opacity: 0; } }
.sitenav {
  position: fixed; z-index: 100; top: calc(16px * var(--s, .85)); left: 50%;
  width: 1200px; height: 64px; padding: 0 11px 0 23px; gap: 14px;
  transform: translateX(-50%) scale(var(--s, .85)); transform-origin: top center;
  view-transition-name: sitenav; display: flex; align-items: center;
  border-radius: 40px; background: rgba(251,244,233,.95);
  border: 1px solid rgba(255,255,255,.9); box-shadow: 0 10px 28px rgba(52,34,27,.12);
  font-family: "Be Vietnam Pro","Noto Sans SC",sans-serif;
}
.sitenav a { text-decoration: none; color: #111; }
.sitenav a:focus-visible { outline: 3px solid #961e20; outline-offset: 2px; }
.sitenav .sn-logo { flex: none; display: flex; align-items: center; }
.sitenav .sn-logo img { display: block; width: 102px; height: 38px; }
.sitenav ul { margin: 0 auto; padding: 0; display: flex; align-items: center; gap: 4px; list-style: none; }
.sitenav li a { display: block; height: 39px; padding: 0 14px; border-radius: 20px; font-size: 14px; line-height: 39px; white-space: nowrap; transition: background-color .18s, color .18s; }
.sitenav li a:hover { background: rgba(150,30,32,.07); color: #961e20; }
.sitenav li a[aria-current] { background: rgba(150,30,32,.11); color: #961e20; }
.sitenav .sn-lang { flex: none; display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 500; color: #6c625b; }
.sitenav .sn-lang a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px; padding: 0 6px; border-radius: 999px;
  color: #6c625b; font-weight: 600; letter-spacing: .02em; transition: background-color .18s, color .18s;
}
.sitenav .sn-lang a:hover { color: #961e20; background: rgba(150,30,32,.07); }
.sitenav .sn-lang a.is-active { color: #961e20; background: rgba(150,30,32,.12); font-weight: 700; }
.sitenav .sn-lang-sep { opacity: .45; user-select: none; }
.sitenav .sn-book {
  flex: none; min-width: 100px; height: 44px; padding: 0 20px; border-radius: 24px;
  background: #961e20; color: #fff; font-size: 14px; font-weight: 700;
  line-height: 44px; text-align: center; white-space: nowrap; transition: background-color .18s;
}
.sitenav .sn-book:hover { background: #7d181a; }
/* 内容准备好之后再淡入，导航不参与 */
.viewport { opacity: 0; transition: opacity .18s ease-out; }
html[data-ready] .viewport { opacity: 1; }
/* 画板里的旧顶栏停用 */
.stage > header { display: none; }
@media (max-width: 900px), (pointer: coarse) and (max-width: 1100px) {
  .sitenav { display: none; }
  .mb-bar { view-transition-name: sitenav; }
}
