#aiMask {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(0, 0, 0, .65); display: none;
}
#aiMask.ai-on { display: block; }

#aiDialog {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(1060px, 94vw); height: min(720px, 88vh);
  background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  display: flex; flex-direction: column;
}
#aiDialog .ai-hd {
  flex: 0 0 40px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; border-bottom: 1px solid #eee; background: #fff;
}
#aiDialog .ai-hd > span { font-size: 13px; color: #666; }
#aiClose { color: #999; font-size: 18px; line-height: 1; text-decoration: none; }
#aiClose:hover { color: #333; }

#aiDialog .ai-body { position: relative; flex: 1; min-height: 0; background: #fff; }
#aiFrame { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

#aiLoading {
  position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center;
  background: #fff; color: #999; font-size: 13px;
}
#aiMask.ai-ready #aiLoading { display: none; }

#aiFallback {
  position: absolute; inset: 0; z-index: 2; display: none;
  flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center; background: #fff; color: #666;
  font-size: 13px; line-height: 1.9;
}
#aiFallback p { margin: 0; }
#aiMask.ai-failed #aiFallback { display: flex; }
#aiMask.ai-failed #aiLoading { display: none; }

/* 右侧工具栏 AI 图标（同 1sf：toolbar.png 的 -355px 0 位置） */
.icon-bar-ai { background: url("toolbar-ai.png") -355px 0 no-repeat; height: 30px; }

@media (max-width: 760px) {
  #aiDialog {
    left: 0; top: 0; transform: none;
    width: 100vw; height: 100vh; height: 100dvh;
    border-radius: 0;
  }
}
