/*
 * 全局快捷悬浮栏。
 * 在首页、多题归纳、深度回忆、教师工作台、用户管理等独立页面统一显示。
 * 入口可按角色权限自动显示，支持拖拽到任意位置，并可在纵向/横向排布间切换。
 */
.kg-global-shortcuts{
  position:fixed;
  right:18px;
  bottom:18px;
  z-index:2147483000;
  width:168px;
  padding:9px;
  border:1px solid rgba(15,23,42,.10);
  border-radius:22px;
  background:rgba(255,255,255,.93);
  box-shadow:0 18px 52px rgba(15,23,42,.18);
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
  color:#0f172a;
  user-select:none;
  touch-action:none;
  font-family:"Microsoft YaHei","PingFang SC",system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
.kg-global-shortcuts[hidden]{display:none!important}
.kg-global-shortcuts.dragging{
  opacity:.95;
  box-shadow:0 24px 66px rgba(15,23,42,.26);
}
.kg-global-shortcuts-head{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:2px 2px 8px;
  cursor:grab;
}
.kg-global-shortcuts.dragging .kg-global-shortcuts-head{cursor:grabbing}
.kg-global-shortcuts-title{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}
.kg-global-shortcuts-grip{
  width:26px;
  height:26px;
  border-radius:10px;
  display:grid;
  place-items:center;
  color:#64748b;
  background:#f8fafc;
  box-shadow:inset 0 0 0 1px rgba(148,163,184,.22);
  flex:0 0 auto;
}
.kg-global-shortcuts-grip svg{
  width:18px;
  height:18px;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
}
.kg-global-shortcuts-title strong{
  display:block;
  color:#0f172a;
  font-size:13px;
  line-height:1.2;
  white-space:nowrap;
}
.kg-global-shortcuts-title small{
  display:block;
  margin-top:1px;
  color:#64748b;
  font-size:11px;
  font-weight:800;
  line-height:1.2;
  white-space:nowrap;
}
.kg-global-shortcuts-toggle{
  width:26px;
  height:26px;
  min-width:26px;
  padding:0;
  border:0;
  border-radius:10px;
  background:#eef2ff;
  color:#2563eb;
  display:grid;
  place-items:center;
  box-shadow:none;
  cursor:pointer;
}
.kg-global-shortcuts-toggle:hover{
  transform:none;
  background:#dbeafe;
  box-shadow:none;
}
.kg-global-shortcuts-toggle svg{
  width:16px;
  height:16px;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.kg-global-shortcuts.layout-vertical{
  width:168px;
}
.kg-global-shortcuts.layout-vertical .kg-global-shortcuts-toggle svg{
  transform:rotate(0deg);
}
.kg-global-shortcuts.layout-horizontal{
  width:auto;
  max-width:calc(100vw - 36px);
  display:flex;
  align-items:center;
  gap:9px;
  padding:9px;
  border-radius:22px;
}
.kg-global-shortcuts.layout-horizontal .kg-global-shortcuts-head{
  width:auto;
  min-width:126px;
  padding:2px;
  flex:0 0 auto;
}
.kg-global-shortcuts.layout-horizontal .kg-global-shortcuts-toggle svg{
  transform:rotate(-90deg);
}
.kg-global-shortcuts.layout-horizontal .kg-global-shortcuts-body{
  display:flex;
  align-items:center;
  gap:7px;
  min-width:0;
}
.kg-global-shortcuts.layout-horizontal .kg-global-shortcuts-link{
  width:auto;
  min-width:42px;
  min-height:38px;
  justify-content:center;
  padding:8px 10px;
}
.kg-global-shortcuts.layout-horizontal .kg-global-shortcuts-link span{
  max-width:74px;
}
@media(max-width:720px),(pointer:coarse){
  .kg-global-shortcuts.layout-horizontal{
    max-width:calc(100vw - 20px);
    overflow-x:auto;
    scrollbar-width:none;
  }
  .kg-global-shortcuts.layout-horizontal::-webkit-scrollbar{display:none}
  .kg-global-shortcuts.layout-horizontal .kg-global-shortcuts-head{
    min-width:112px;
  }
  .kg-global-shortcuts.layout-horizontal .kg-global-shortcuts-link span{
    max-width:64px;
  }
}
@media(max-width:520px){
  .kg-global-shortcuts.layout-horizontal .kg-global-shortcuts-title strong{
    display:none;
  }
  .kg-global-shortcuts.layout-horizontal .kg-global-shortcuts-title small{
    display:none;
  }
  .kg-global-shortcuts.layout-horizontal .kg-global-shortcuts-head{
    min-width:auto;
  }
}
.kg-global-shortcuts-body{
  display:grid;
  gap:7px;
}
.kg-global-shortcuts-link{
  width:100%;
  min-height:38px;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:8px;
  border:0;
  border-radius:14px;
  padding:8px 10px;
  background:#fff;
  color:#0f172a;
  text-decoration:none;
  font-size:13px;
  font-weight:950;
  line-height:1.15;
  box-shadow:0 1px 0 rgba(15,23,42,.08),0 0 0 1px rgba(15,23,42,.08);
  cursor:pointer;
  box-sizing:border-box;
}
.kg-global-shortcuts-link:hover{
  transform:translateY(-1px);
  box-shadow:0 10px 24px rgba(15,23,42,.12),0 0 0 1px rgba(15,23,42,.10);
}
.kg-global-shortcuts-link svg{
  width:18px;
  height:18px;
  flex:0 0 auto;
  fill:none;
  stroke:currentColor;
  stroke-width:1.9;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.kg-global-shortcuts-link span{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.kg-global-shortcuts-link.current{
  background:linear-gradient(135deg,var(--role-soft,#dbeafe),#fff);
  color:var(--role-primary,#2563eb);
  box-shadow:0 0 0 2px color-mix(in srgb,var(--role-primary,#2563eb) 18%,transparent);
}
.kg-global-shortcuts-link.training{
  background:linear-gradient(135deg,#7c3aed,#6366f1);
  color:#fff;
  box-shadow:0 10px 24px rgba(124,58,237,.22);
}
.kg-global-shortcuts-link.recall{
  background:linear-gradient(135deg,#db2777,#f97316);
  color:#fff;
  box-shadow:0 10px 24px rgba(219,39,119,.20);
}
.kg-global-shortcuts-link.bank{
  background:linear-gradient(135deg,#0891b2,#0e7490);
  color:#fff;
  box-shadow:0 10px 24px rgba(8,145,178,.24);
}
.kg-global-shortcuts-link.users{
  background:linear-gradient(135deg,#7c3aed,#f59e0b);
  color:#fff;
  box-shadow:0 10px 24px rgba(124,58,237,.22);
}
.kg-global-shortcuts-link.current.training,
.kg-global-shortcuts-link.current.recall,
.kg-global-shortcuts-link.current.bank,
.kg-global-shortcuts-link.current.users{
  outline:3px solid rgba(255,255,255,.72);
  outline-offset:-5px;
}
.kg-global-shortcuts-empty{
  border-radius:14px;
  padding:10px;
  color:#64748b;
  background:#f8fafc;
  font-size:12px;
  line-height:1.45;
  box-shadow:inset 0 0 0 1px rgba(148,163,184,.22);
}
@media(max-width:720px),(pointer:coarse){
  .kg-global-shortcuts{
    right:10px;
    bottom:82px;
    padding:8px;
    border-radius:19px;
  }
  .kg-global-shortcuts.layout-vertical{
    width:152px;
  }
  .kg-global-shortcuts-link{
    min-height:35px;
    padding:7px 9px;
    border-radius:12px;
    font-size:12px;
  }
  .kg-global-shortcuts-link svg{width:16px;height:16px}
}
@media(max-width:420px){
  .kg-global-shortcuts{
    max-width:calc(100vw - 20px);
  }
  .kg-global-shortcuts.layout-vertical{
    width:auto;
  }
  .kg-global-shortcuts-body{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

.kg-global-shortcuts-link.settings{
  background:linear-gradient(135deg,#0f172a,#475569);
  color:#fff;
  box-shadow:0 10px 24px rgba(15,23,42,.22);
}
.kg-global-shortcuts-link.current.settings{
  outline:3px solid rgba(255,255,255,.72);
  outline-offset:-5px;
}

/* 修复切换按钮位于拖拽手柄内时点击被拖拽事件吞掉的视觉/交互边界。 */
.kg-global-shortcuts-toggle{
  position:relative;
  z-index:2;
  touch-action:manipulation;
}
.kg-global-shortcuts-link{
  position:relative;
  z-index:1;
  touch-action:manipulation;
}

/* 图标栏不能依赖浏览器原生 title：它首悬停会有额外停留阈值，且后续悬停的表现不一致。 */
.kg-global-shortcuts [data-tooltip]{position:relative}
.kg-global-shortcuts [data-tooltip]::after{
  content:attr(data-tooltip);position:absolute;z-index:4;left:calc(100% + 8px);top:50%;
  transform:translate(4px,-50%);padding:6px 9px;border-radius:8px;background:#0f172a;color:#fff;
  box-shadow:0 8px 20px rgba(15,23,42,.22);font:750 12px/1.2 "Microsoft YaHei","PingFang SC",system-ui,sans-serif;
  white-space:nowrap;opacity:0;visibility:hidden;pointer-events:none;
  transition:opacity 80ms ease,transform 80ms ease,visibility 0s;transition-delay:0ms;
}
.kg-global-shortcuts [data-tooltip][data-tooltip-side="left"]::after{
  right:calc(100% + 8px);left:auto;transform:translate(-4px,-50%);
}
.kg-global-shortcuts [data-tooltip]:hover::after,
.kg-global-shortcuts [data-tooltip]:focus-visible::after{
  opacity:1;visibility:visible;transform:translate(0,-50%);transition-delay:0ms;
}
.kg-global-shortcuts [data-tooltip][data-tooltip-side="left"]:hover::after,
.kg-global-shortcuts [data-tooltip][data-tooltip-side="left"]:focus-visible::after{transform:translate(0,-50%)}


/* v8.6.2 P2.2.10 — compact icon-only global shortcut bar */
.kg-global-shortcuts{
  width:54px!important;
  padding:6px!important;
  box-sizing:border-box!important;
  border-radius:16px!important;
}
.kg-global-shortcuts-head{
  justify-content:center!important;
  gap:2px!important;
  padding:0 0 5px!important;
}
.kg-global-shortcuts-title{gap:0!important}
.kg-global-shortcuts-title>div,
.kg-global-shortcuts-title strong,
.kg-global-shortcuts-title small{display:none!important}
.kg-global-shortcuts-grip,
.kg-global-shortcuts-toggle{
  width:19px!important;
  min-width:19px!important;
  height:19px!important;
  border-radius:7px!important;
}
.kg-global-shortcuts-grip svg,
.kg-global-shortcuts-toggle svg{
  width:13px!important;
  height:13px!important;
}
.kg-global-shortcuts.layout-vertical{width:54px!important}
.kg-global-shortcuts-body{gap:5px!important}
.kg-global-shortcuts-link{
  width:38px!important;
  min-width:38px!important;
  max-width:38px!important;
  min-height:38px!important;
  height:38px!important;
  justify-content:center!important;
  gap:0!important;
  padding:0!important;
  border-radius:11px!important;
}
.kg-global-shortcuts-link svg{width:18px!important;height:18px!important}
.kg-global-shortcuts-link span{display:none!important}
.kg-global-shortcuts.layout-horizontal{
  width:auto!important;
  max-width:calc(100vw - 24px)!important;
  gap:5px!important;
  padding:6px!important;
  border-radius:16px!important;
}
.kg-global-shortcuts.layout-horizontal .kg-global-shortcuts-head{
  width:auto!important;
  min-width:40px!important;
  padding:0 5px 0 0!important;
  gap:2px!important;
}
.kg-global-shortcuts.layout-horizontal .kg-global-shortcuts-body{gap:5px!important}
.kg-global-shortcuts.layout-horizontal .kg-global-shortcuts-link{
  width:38px!important;
  min-width:38px!important;
  max-width:38px!important;
  min-height:38px!important;
  height:38px!important;
  padding:0!important;
}
.kg-global-shortcuts-link.workspace{
  background:linear-gradient(135deg,#7c3aed,#6366f1);
  color:#fff;
  box-shadow:0 8px 18px rgba(124,58,237,.20);
}
.kg-global-shortcuts-link.current.workspace{
  outline:3px solid rgba(255,255,255,.72);
  outline-offset:-5px;
}
@media(max-width:720px),(pointer:coarse){
  .kg-global-shortcuts{
    right:10px;
    bottom:82px;
    width:48px!important;
    padding:5px!important;
    border-radius:15px!important;
  }
  .kg-global-shortcuts.layout-vertical{width:48px!important}
  .kg-global-shortcuts-link,
  .kg-global-shortcuts.layout-horizontal .kg-global-shortcuts-link{
    width:36px!important;
    min-width:36px!important;
    max-width:36px!important;
    height:36px!important;
    min-height:36px!important;
    border-radius:10px!important;
  }
  .kg-global-shortcuts-link svg{width:17px!important;height:17px!important}
}
@media(max-width:420px){
  .kg-global-shortcuts.layout-vertical{width:48px!important}
  .kg-global-shortcuts-body{grid-template-columns:1fr!important}
}

/* P2.2.34 · inactive shortcuts use white surfaces; only current shortcut is color-filled. */
.kg-global-shortcuts-link.training,
.kg-global-shortcuts-link.recall,
.kg-global-shortcuts-link.bank,
.kg-global-shortcuts-link.users,
.kg-global-shortcuts-link.settings,
.kg-global-shortcuts-link.workspace{
  background:#fff;
  box-shadow:0 1px 0 rgba(15,23,42,.08),0 0 0 1px rgba(15,23,42,.08);
}
.kg-global-shortcuts-link.training{color:#6d28d9}
.kg-global-shortcuts-link.recall{color:#be185d}
.kg-global-shortcuts-link.bank{color:#0e7490}
.kg-global-shortcuts-link.users{color:#9a3412}
.kg-global-shortcuts-link.settings{color:#334155}
.kg-global-shortcuts-link.workspace{color:#4f46e5}
.kg-global-shortcuts-link.current.training{
  background:linear-gradient(135deg,#7c3aed,#6366f1);color:#fff;box-shadow:0 8px 18px rgba(124,58,237,.20)
}
.kg-global-shortcuts-link.current.recall{
  background:linear-gradient(135deg,#db2777,#f97316);color:#fff;box-shadow:0 8px 18px rgba(219,39,119,.20)
}
.kg-global-shortcuts-link.current.bank{
  background:linear-gradient(135deg,#0891b2,#0e7490);color:#fff;box-shadow:0 8px 18px rgba(8,145,178,.22)
}
.kg-global-shortcuts-link.current.users{
  background:linear-gradient(135deg,#7c3aed,#f59e0b);color:#fff;box-shadow:0 8px 18px rgba(124,58,237,.20)
}
.kg-global-shortcuts-link.current.settings{
  background:linear-gradient(135deg,#0f172a,#475569);color:#fff;box-shadow:0 8px 18px rgba(15,23,42,.20)
}
.kg-global-shortcuts-link.current.workspace{
  background:linear-gradient(135deg,#7c3aed,#6366f1);color:#fff;box-shadow:0 8px 18px rgba(124,58,237,.20)
}

/* P2.2.35 · global shortcuts: black icons by default, color fill only when current. */
.kg-global-shortcuts-link.training,
.kg-global-shortcuts-link.recall,
.kg-global-shortcuts-link.bank,
.kg-global-shortcuts-link.users,
.kg-global-shortcuts-link.settings,
.kg-global-shortcuts-link.workspace{
  color:#111827;
}
.kg-global-shortcuts-link:not(.current):hover,
.kg-global-shortcuts-link:not(.current):focus-visible{
  color:#111827;
  background:#f8fafc;
}
.kg-global-shortcuts-link.current.training,
.kg-global-shortcuts-link.current.recall,
.kg-global-shortcuts-link.current.bank,
.kg-global-shortcuts-link.current.users,
.kg-global-shortcuts-link.current.settings,
.kg-global-shortcuts-link.current.workspace{
  color:#fff;
}

/* P4.5 · canvas pages must retain a visible shortcut surface after every redraw. */
.kg-global-shortcuts{
  background:#1f2937!important;
  border-color:#475569!important;
  color:#f8fafc!important;
  box-shadow:0 16px 38px rgba(15,23,42,.34)!important;
}
.kg-global-shortcuts-grip{
  background:#334155!important;
  color:#e2e8f0!important;
  box-shadow:inset 0 0 0 1px rgba(226,232,240,.18)!important;
}
.kg-global-shortcuts-toggle{
  background:#f97316!important;
  color:#fff!important;
  box-shadow:0 5px 12px rgba(249,115,22,.38)!important;
}
.kg-global-shortcuts-toggle:hover,
.kg-global-shortcuts-toggle:focus-visible{
  background:#ea580c!important;
  outline:2px solid #fed7aa!important;
  outline-offset:2px;
}
