/* side.css — 侧边快速跳转：宽屏导航轨，窄屏抽屉；圆角与层次收口 */
:root {
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --scrim: rgba(18, 21, 15, 0.46);
/* taste-skill-ignore */   --float: 0 10px 30px rgba(16, 20, 14, 0.14), 0 2px 6px rgba(16, 20, 14, 0.08);
  --snav-w: 26px;
}

/* ---------- 圆角收口 ---------- */
.btn { border-radius: var(--r-sm); }
.unit { border-radius: 8px; overflow: hidden; }
.unit > summary { border-radius: 8px; }
.deeper { border-radius: var(--r-xs); }
.q { border-radius: var(--r-sm); }
.opt { border-radius: var(--r-xs); }
.ov-out { border-radius: var(--r-md); }
pre { border-radius: var(--r-sm); }
.case { border-radius: var(--r-sm); }
.tbl { border-radius: var(--r-xs); }
.p-track { border-radius: 99px; }
.p-track i { border-radius: 99px; }
.zone-bar { border-radius: 99px; overflow: hidden; }
.zone-bar i { border-radius: 99px; }
.mx span { border-radius: var(--r-xs); }
.kbtn { border-radius: var(--r-xs); }
.play, .chk, .p-next { border-radius: 0; }
.band { border-radius: 0; }

/* 浮层才有的阴影：抽屉、导航轨展开、按钮按下 */
/* taste-skill-ignore */ .unit, .q, .case, .ov-out { box-shadow: none; }

/* ---------- 顶栏菜单按钮（窄屏） ---------- */
.menu-btn {
  display: none; align-items: center; gap: 0.55rem;
  background: var(--surface); border: 0; border-radius: var(--r-sm);
  padding: 0.6rem 0.85rem; font-size: 0.8125rem; color: var(--ink);
  cursor: pointer; min-height: 44px;
  transition: background 0.16s;
}
.menu-btn:hover { background: var(--sunken); }
.menu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.menu-btn i { display: grid; gap: 3px; }
.menu-btn i b { display: block; width: 15px; height: 2px; background: currentColor; border-radius: 1px; }
@media (max-width: 1099px) { .menu-btn { display: inline-flex; } }

/* ---------- 右侧导航轨：10 条窗口 ---------- */
.snav {
  position: fixed; right: 8px; top: 50%; transform: translateY(-50%);
  z-index: 45; display: none; flex-direction: column; align-items: flex-end;
  padding: 2px; gap: 0;
}
@media (min-width: 1100px) { .snav { display: flex; } }

.rail-track { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.rail-gap { display: block; height: 12px; width: 18px; }

.rail-hit {
  height: 20px; width: 30px; opacity: 0; pointer-events: none;
  position: relative; transition: opacity 0.2s;
}
.rail-hit::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px;
  margin: -4px 0 0 -4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); opacity: 0.7;
}
.rail-hit-top::after { transform: rotate(-135deg); }
.snav:hover .rail-hit { pointer-events: auto; }
.snav.has-more .rail-hit-bottom, .snav.has-less .rail-hit-top { opacity: 1; }
.snav.has-more .rail-hit-bottom:hover::after, .snav.has-less .rail-hit-top:hover::after { border-color: var(--accent); }

.rail-track a {
  display: flex; align-items: center; justify-content: flex-end;
  text-decoration: none; position: relative; padding-block: 1px;
}
.rail-track a i {
  display: block; height: 2px; width: 14px; border-radius: 2px;
  background: var(--muted); opacity: 0.42;
  transition: width 0.22s var(--ease), background 0.22s, opacity 0.22s;
}
.rail-track a span {
  position: absolute; right: 24px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; font-size: 0.8125rem; color: var(--ink);
  background: var(--surface); border-radius: var(--r-sm);
  padding: 0.2rem 0.5rem; max-width: 0; opacity: 0; overflow: hidden;
  /* taste-skill-ignore */ box-shadow: var(--float);
  transition: max-width 0.24s var(--ease), opacity 0.2s;
  pointer-events: none;
}
.rail-track a.on i { width: 30px; background: var(--accent); opacity: 1; }
.rail-track a:hover i { opacity: 1; background: var(--ink); }
.rail-track a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* 整排展开 + 距离渐隐 */
.snav.open .rail-track a i {
  width: max(8px, calc(26px - var(--d, 0) * 3px));
  background: var(--muted); opacity: max(0.22, calc(1 - var(--d, 0) * 0.22));
}
.snav.open .rail-track a span {
  max-width: max(0px, calc(190px - var(--d, 0) * 42px));
  opacity: max(0, calc(1 - var(--d, 0) * 0.3));
}
.snav.open .rail-track a.focus span { max-width: 230px; opacity: 1; }
.snav.open .rail-track a.focus i { width: 26px; background: var(--accent); opacity: 1; }
.snav.open .rail-track a.on i { background: var(--accent); }

 ---------- 回顶 ---------- */
.totop {
  position: fixed; right: 18px; bottom: 20px; z-index: 44;
  width: 44px; height: 44px; border: 0; border-radius: 99px;
  background: var(--ink); color: var(--bg); font-size: 1rem;
  cursor: pointer; opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.2s;
/* taste-skill-ignore */   box-shadow: var(--float);
}
.totop.show { opacity: 1; pointer-events: auto; }
.totop:hover { transform: translateY(-2px); }
.totop:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (min-width: 1100px) { .totop { right: 62px; bottom: 28px; } }

/* ---------- 抽屉与遮罩（窄屏） ---------- */
.scrim { display: none; position: fixed; inset: 0; background: var(--scrim); z-index: 60; }
.scrim.show { display: block; }

.drawer {
  display: none; position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(86vw, 350px); background: var(--bg);
  border-radius: var(--r-lg) 0 0 var(--r-lg);
/* taste-skill-ignore */   flex-direction: column; box-shadow: var(--float);
}
.drawer.show { display: flex; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.15rem 0.8rem; border-bottom: 2px solid var(--surface);
}
.drawer-head .t { font-size: 0.8125rem; letter-spacing: 0.04em; color: var(--muted); }
.drawer-close {
  background: var(--surface); border: 0; border-radius: var(--r-sm);
  width: 36px; height: 36px; cursor: pointer; color: var(--ink);
  font-size: 1rem; line-height: 1;
}
.drawer-close:hover { background: var(--sunken); }
.drawer-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.drawer-body { overflow-y: auto; padding: 0.6rem 0.5rem 1.4rem; }
.drawer-group {
  font-size: 0.75rem; letter-spacing: 0.08em; color: var(--muted);
  padding: 0.9rem 0.7rem 0.35rem;
}
.drawer a {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.6rem;
  align-items: baseline; padding: 0.6rem 0.7rem; border-radius: var(--r-sm);
  color: var(--ink); font-size: 0.9375rem;
  transition: background 0.16s;
}
.drawer a:hover { background: var(--surface); }
.drawer a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.drawer a.on { background: var(--surface); }
.drawer a em { font-style: normal; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.drawer-foot { margin-top: auto; padding: 0.9rem 1.15rem 1.2rem; border-top: 2px solid var(--surface); }
.drawer-foot p { font-size: 0.75rem; color: var(--muted); line-height: 1.6; }
@media (min-width: 1100px) { .drawer.show, .scrim.show { display: none; } }

/* 抽屉打开时锁滚动 */
body.locked { overflow: hidden; }

/* 锚点跳转留出顶栏高度 */
section[id] { scroll-margin-top: 84px; }

/* 窄屏：顶栏只留标记与目录按钮，避免两套导航 */
@media (max-width: 1099px) {
  .top .nav { display: none; }
  .top { align-items: center; }
  .menu-btn { margin-left: auto; }
}
