/* ==========================================================================
   星际导航 · 全局便签
   - 右下角入口：电脑端在音乐图标上方；手机端放进右下角操作列（音乐上方）
   - 已植入便签浮层：nav-note.js 渲染，可拖动 / 可调整大小，位置与尺寸存本地
   ========================================================================== */

/* ---------------- 右下角入口 ---------------- */
.nav-note-fab{
  position:fixed;right:20px;bottom:calc(190px + env(safe-area-inset-bottom));
  width:42px;height:42px;border-radius:50%;
  border:1px solid var(--border);background:var(--surface);color:var(--accent);
  display:grid;place-items:center;font-size:17px;cursor:pointer;z-index:94;
  box-shadow:var(--shadow);transition:all .2s ease;
  -webkit-appearance:none;appearance:none;padding:0;line-height:1;
}
.nav-note-fab:hover{color:#fff;background:var(--grad);border-color:transparent;transform:translateY(-2px)}
.nav-note-fab:active{transform:scale(.94)}
/* 有便签已植入前端时，入口右上角一个小圆点提示 */
.nav-note-fab.has-pin::after{
  content:'';position:absolute;top:8px;right:8px;width:7px;height:7px;border-radius:50%;
  background:var(--accent);box-shadow:0 0 0 2px var(--surface);
}
body.no-note .nav-note-fab,
body.no-note .mdock-acts .tbtn.nav-note-mact{display:none}

/* ---------------- 已植入便签浮层 ----------------
   层级要压过 sticky 顶栏(100) 和侧栏(130/131)，否则便签拖到页面顶部后
   标题栏会被顶栏盖住、再也抓不到；同时低于抽屉(155+)、弹窗(610) 与 toast。 */
.nav-note-layer{position:fixed;inset:0;z-index:135;pointer-events:none}
.nn-item{
  position:absolute;width:248px;max-width:calc(100vw - 16px);
  display:flex;flex-direction:column;
  min-width:150px;min-height:64px;
  border-radius:13px;background:#fff6b7;color:#23262d;
  border:1px solid rgba(15,23,42,.08);
  box-shadow:0 12px 28px rgba(15,23,42,.16),0 2px 6px rgba(15,23,42,.06);
  pointer-events:auto;overflow:hidden;
  transition:box-shadow .18s ease;
  animation:nn-in .18s ease;
}
@keyframes nn-in{from{opacity:0;transform:translateY(6px) scale(.98)}to{opacity:1;transform:none}}
.nn-item.nn-static{animation:none}
.nn-item:hover{box-shadow:0 16px 34px rgba(15,23,42,.2),0 3px 8px rgba(15,23,42,.08)}
.nn-item.nn-drag,.nn-item.nn-resizing{transition:none;box-shadow:0 20px 44px rgba(15,23,42,.24)}

/* 标题栏：拖动移动 */
.nn-hd{
  flex:none;display:flex;align-items:center;gap:4px;padding:6px 8px 5px 7px;
  cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none;
  background:rgba(255,255,255,.32);border-bottom:1px solid rgba(15,23,42,.06);
}
.nn-item.nn-drag .nn-hd{cursor:grabbing}
.nn-grip{font-size:13px;color:rgba(35,38,45,.38);flex:none}
.nn-title{
  flex:1;min-width:0;font-size:12.5px;font-weight:800;line-height:1.3;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.nn-hd button{
  flex:none;width:22px;height:22px;border-radius:6px;border:0;background:transparent;
  color:rgba(35,38,45,.55);cursor:pointer;display:grid;place-items:center;font-size:12px;
  opacity:0;transition:opacity .15s,background .15s,color .15s;
  -webkit-appearance:none;appearance:none;padding:0;line-height:1;
}
.nn-item:hover .nn-hd button,.nn-hd button:focus-visible{opacity:1}
.nn-hd button:hover{background:rgba(15,23,42,.08);color:#23262d}
.nn-hd button.nn-del:hover{background:#ff5f57;color:#fff}

/* 正文 */
.nn-body{
  flex:1;min-height:0;padding:2px 10px 8px;font-size:12.5px;line-height:1.6;
  white-space:pre-wrap;word-break:break-word;overflow:auto;max-height:168px;
}
/* 用户手动调过尺寸：正文跟随卡片高度，不再限高 */
.nn-item.nn-sized .nn-body{max-height:none}
.nn-body:empty{display:none}

/* 底部拖动条：抓住它也能整块移动（标题栏被遮住时的备用入口） */
.nn-ft{
  flex:none;height:14px;display:flex;align-items:center;justify-content:center;
  color:rgba(35,38,45,.3);font-size:10px;line-height:1;
  cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none;
  background:rgba(255,255,255,.2);border-top:1px solid rgba(15,23,42,.05);
}
.nn-item.nn-drag .nn-ft{cursor:grabbing}

/* 右下角缩放把手 */
.nn-rs{
  position:absolute;right:0;bottom:0;width:16px;height:16px;
  cursor:nwse-resize;touch-action:none;z-index:3;
  border-bottom-right-radius:13px;
  background:linear-gradient(135deg,transparent 0 52%,rgba(35,38,45,.3) 52% 60%,transparent 60% 70%,rgba(35,38,45,.3) 70% 78%,transparent 78%);
}
.nn-item:hover .nn-rs{background:linear-gradient(135deg,transparent 0 52%,rgba(35,38,45,.5) 52% 60%,transparent 60% 70%,rgba(35,38,45,.5) 70% 78%,transparent 78%)}

/* ---------------- 最小化：只剩一个可拖动的图标 ----------------
   收起后不再占正文空间；悬停时在图标旁边浮出预览（不改图标大小，不会挤动别的元素），
   移开鼠标自动收回；单击图标恢复成完整便签。 */
.nn-mini{
  display:none;width:100%;height:100%;padding:0;margin:0;border:0;
  background:transparent;color:rgba(35,38,45,.82);
  align-items:center;justify-content:center;font-size:18px;line-height:1;
  cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none;
  -webkit-appearance:none;appearance:none;
}
.nn-item.nn-min{
  width:40px!important;height:40px!important;min-width:0;min-height:0;
  border-radius:50%;padding:0;overflow:visible;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 8px 20px rgba(15,23,42,.22),0 2px 6px rgba(15,23,42,.08);
  cursor:grab;
}
.nn-item.nn-min .nn-hd,
.nn-item.nn-min .nn-body,
.nn-item.nn-min .nn-ft,
.nn-item.nn-min .nn-rs{display:none}
.nn-item.nn-min .nn-mini{display:flex}
.nn-item.nn-min:hover{z-index:6;box-shadow:0 12px 26px rgba(15,23,42,.28),0 3px 8px rgba(15,23,42,.1)}
.nn-item.nn-min.nn-drag{cursor:grabbing;box-shadow:0 16px 34px rgba(15,23,42,.3)}
.nn-item.nn-min.nn-drag .nn-peek{display:none!important}

/* 悬停预览：贴着图标右侧展开，靠近右 / 下边缘时自动翻到左 / 上方 */
.nn-peek{
  display:none;position:absolute;left:calc(100% + 10px);top:0;z-index:7;
  width:248px;max-height:300px;padding:9px 11px 10px;overflow:auto;
  border-radius:12px;background:inherit;color:inherit;
  border:1px solid rgba(15,23,42,.1);
  box-shadow:0 16px 34px rgba(15,23,42,.2),0 3px 8px rgba(15,23,42,.08);
  pointer-events:none;
}
.nn-item.nn-min:hover .nn-peek{display:block;animation:nn-peek-in .16s ease both}
.nn-item.nn-peek-l .nn-peek{left:auto;right:calc(100% + 10px)}
.nn-item.nn-peek-u .nn-peek{top:auto;bottom:0}
@keyframes nn-peek-in{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}
.nn-peek-t{font-size:12.5px;font-weight:800;line-height:1.35;margin-bottom:4px;word-break:break-word}
.nn-peek-b{font-size:12.5px;line-height:1.62;white-space:pre-wrap;word-break:break-word}
.nn-peek-b:empty{display:none}
/* 触屏没有 hover，预览会卡住：直接关掉，点图标展开即可 */
@media (hover:none){
  .nn-item.nn-min:hover .nn-peek{display:none}
}
@media(max-width:640px){
  .nn-peek{width:220px}
}

/* 平板（768–1279）：与手机端悬浮顺序一致，便签在最上方（音乐 246 / QQ 群 190 / 赞助 134） */
@media(min-width:768px) and (max-width:1279px){
  .nav-note-fab{bottom:calc(302px + env(safe-area-inset-bottom))}
}
@media(max-width:767px){
  /* 手机（与导航统一 ≤767）：入口收进右下角操作列，固定排在音乐图标上方，和音乐同一套 34px 圆形；
     隐藏独立的便签悬浮按钮，避免和操作列错位重叠 */
  .nav-note-fab{display:none}
  .mdock-acts .tbtn.nav-note-mact{display:inline-flex}
  .nn-item{width:220px;min-width:140px;border-radius:12px}
  .nn-hd button{opacity:1}
  .nn-body{max-height:132px;font-size:12px}
  .nn-item.nn-sized .nn-body{max-height:none}
}
