/* HOJ AI 助教面板 —— 全部类名带 hojai- 前缀，避免污染站点样式 */
.hojai-ball {
  position: fixed;
  left: 26px;
  bottom: 26px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a7cf6, #7b5cf0);
  box-shadow: 0 6px 20px rgba(74, 124, 246, .38);
  cursor: grab;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.hojai-ball:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 10px 26px rgba(74, 124, 246, .5); }
.hojai-ball.is-dragging {
  cursor: grabbing;
  transition: none;
  transform: scale(1.06);
  box-shadow: 0 14px 34px rgba(74, 124, 246, .55);
}
.hojai-ball svg { width: 26px; height: 26px; fill: #fff; }
.hojai-ball.is-open { background: linear-gradient(135deg, #8b96a8, #6b7789); box-shadow: 0 6px 18px rgba(107,119,137,.35); }

.hojai-panel {
  position: fixed;
  left: 26px;
  bottom: 92px;
  width: 460px;
  height: 660px;
  max-height: calc(100vh - 20px);
  max-width: calc(100vw - 20px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(15, 30, 60, .22), 0 2px 8px rgba(15, 30, 60, .08);
  z-index: 99999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #1f2733;
  transform-origin: bottom left;
  animation: hojai-in .18s ease-out;
}
@keyframes hojai-in { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.hojai-panel.is-open { display: flex; }

/* 右下角拖拽调大小 */
.hojai-resize {
  position: absolute;
  right: 0; bottom: 0;
  width: 16px; height: 16px;
  cursor: nwse-resize;
  z-index: 6;
  touch-action: none;
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 3px;
}
.hojai-resize::after {
  content: '';
  width: 8px; height: 8px;
  border-right: 2px solid #c8d0de;
  border-bottom: 2px solid #c8d0de;
  border-bottom-right-radius: 3px;
  opacity: .9;
  transition: border-color .15s ease;
}
.hojai-resize:hover::after, .hojai-resize.is-active::after { border-color: #4a7cf6; }
.hojai-resize.is-active { background: rgba(74, 124, 246, .06); border-top-left-radius: 6px; }

.hojai-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #eef1f6;
  background: #fff;
  flex: 0 0 auto;
}
.hojai-title { font-weight: 600; font-size: 15px; color: #1f2733; }
.hojai-sub { font-size: 12px; color: #8a94a6; margin-left: 2px; }
.hojai-spacer { flex: 1 1 auto; }
.hojai-quota {
  font-size: 12px;
  color: #6b7789;
  background: #f3f5fa;
  border-radius: 10px;
  padding: 3px 9px;
  white-space: nowrap;
}
.hojai-quota.is-low { color: #d9534f; background: #fdf0ef; }
.hojai-icon-btn {
  width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent;
  cursor: pointer; color: #8a94a6; font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.hojai-icon-btn:hover { background: #f3f5fa; color: #4a7cf6; }

.hojai-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 14px 6px;
  background: #fbfcfe;
  scroll-behavior: smooth;
}
.hojai-body::-webkit-scrollbar { width: 6px; }
.hojai-body::-webkit-scrollbar-thumb { background: #dfe4ee; border-radius: 3px; }

.hojai-msg { display: flex; margin-bottom: 14px; }
.hojai-msg.is-user { justify-content: flex-end; }
.hojai-bubble {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 12px;
  line-height: 1.68;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.hojai-msg.is-ai .hojai-bubble { background: #fff; border: 1px solid #eef1f6; border-top-left-radius: 4px; box-shadow: 0 1px 2px rgba(15,30,60,.03); }
.hojai-msg.is-user .hojai-bubble { background: #4a7cf6; color: #fff; border-top-right-radius: 4px; }

.hojai-bubble p { margin: 0 0 8px; }
.hojai-bubble p:last-child { margin-bottom: 0; }
.hojai-bubble h3, .hojai-bubble h4 { margin: 12px 0 6px; font-size: 14px; color: #2c3a4e; }
.hojai-bubble h3 { font-size: 15px; }
.hojai-bubble ul, .hojai-bubble ol { margin: 4px 0 8px; padding-left: 20px; }
.hojai-bubble li { margin: 2px 0; }
.hojai-bubble code {
  background: #f2f4f9; padding: 1px 5px; border-radius: 4px;
  font-family: Consolas, Monaco, "Courier New", monospace; font-size: 12.5px; color: #c7254e;
}
.hojai-bubble pre {
  background: #1f2733; color: #e6edf3; padding: 10px 12px; border-radius: 8px;
  overflow-x: auto; margin: 8px 0; font-size: 12.5px; line-height: 1.55;
}
.hojai-bubble pre code { background: transparent; color: inherit; padding: 0; font-size: 12.5px; }
.hojai-bubble strong { font-weight: 600; color: #1a2433; }
.hojai-bubble blockquote { margin: 8px 0; padding: 4px 10px; border-left: 3px solid #dfe4ee; color: #6b7789; }

.hojai-cursor {
  display: inline-block; width: 6px; height: 15px; background: #4a7cf6;
  vertical-align: -2px; margin-left: 2px; animation: hojai-blink .9s steps(2) infinite;
}
@keyframes hojai-blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

.hojai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; background: #fbfcfe; flex: 0 0 auto; }
.hojai-chip {
  border: 1px solid #dde3ef; background: #fff; color: #46536a;
  border-radius: 14px; padding: 5px 11px; font-size: 12.5px; cursor: pointer;
  transition: all .15s ease; white-space: nowrap;
}
.hojai-chip:hover { border-color: #4a7cf6; color: #4a7cf6; background: #f5f8ff; }
.hojai-chip:disabled { opacity: .45; cursor: not-allowed; }

.hojai-foot { flex: 0 0 auto; padding: 10px 14px 12px; border-top: 1px solid #eef1f6; background: #fff; }
.hojai-inputwrap { display: flex; align-items: flex-end; gap: 8px; }
.hojai-input {
  flex: 1 1 auto; border: 1px solid #e2e7f0; border-radius: 10px; padding: 9px 11px;
  font-size: 13.5px; line-height: 1.5; resize: none; max-height: 120px; min-height: 40px;
  outline: none; font-family: inherit; color: #1f2733; background: #fff;
  transition: border-color .15s ease;
}
.hojai-input:focus { border-color: #4a7cf6; }
.hojai-send {
  width: 40px; height: 40px; border-radius: 10px; border: 0; cursor: pointer;
  background: #4a7cf6; color: #fff; display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto; transition: background .15s ease;
}
.hojai-send:hover { background: #3a6ae0; }
.hojai-send:disabled { background: #c7d2e6; cursor: not-allowed; }
.hojai-send svg { width: 18px; height: 18px; fill: #fff; }
.hojai-tip { font-size: 11.5px; color: #a2abbd; margin-top: 6px; text-align: center; }

.hojai-notice {
  margin: 10px 0; padding: 10px 12px; border-radius: 8px;
  background: #fff7e6; color: #a5691b; font-size: 13px; line-height: 1.6;
}
.hojai-notice.is-error { background: #fdf0ef; color: #b3493f; }

@media (max-width: 560px) {
  .hojai-panel {
    left: 0 !important; top: 0 !important; right: 0; bottom: 0 !important;
    width: 100% !important; height: 100% !important;
    max-height: 100vh; border-radius: 0;
  }
  .hojai-ball { width: 48px; height: 48px; }
  .hojai-resize { display: none; }
}
