.fh-annot-toolbar,
.fh-annot-panel,
.fh-annot-editor,
.fh-annot-fab {
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.fh-ann-highlight {
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.12) 0%, rgba(250, 204, 21, 0.42) 62%, rgba(250, 204, 21, 0.36) 100%);
  border-radius: 3px;
}

.fh-ann-underline {
  text-decoration-line: underline;
  text-decoration-color: #2563eb;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

.fh-ann-note {
  background: rgba(251, 146, 60, 0.16);
  border-bottom: 2px dotted #d97706;
  border-radius: 3px;
  cursor: pointer;
}

mjx-container.fh-ann-formula {
  border-radius: 5px;
  cursor: pointer;
}

mjx-container.fh-ann-formula.fh-ann-highlight {
  padding: 0 0.12em;
}

mjx-container.fh-ann-formula.fh-ann-underline {
  border-bottom: 2px solid #2563eb;
  padding-bottom: 1px;
  text-decoration: none;
}

mjx-container.fh-ann-formula.fh-ann-note {
  border-bottom: 2px dotted #d97706;
  padding-bottom: 1px;
}

.fh-annot-toolbar {
  position: fixed;
  z-index: 10020;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid #334155;
  border-radius: 10px;
  background: #0f172a;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.26);
}

.fh-annot-toolbar.open {
  display: flex;
}

.fh-annot-btn {
  border: 1px solid #334155;
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.2;
  padding: 7px 10px;
  white-space: nowrap;
}

.fh-annot-btn:hover,
.fh-annot-btn:focus-visible {
  background: #1e293b;
  outline: none;
}

.fh-annot-btn.hot {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
}

.fh-annot-fab {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 10010;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #1f2937;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

.fh-annot-fab:hover,
.fh-annot-fab:focus-visible {
  border-color: #2563eb;
  color: #1d4ed8;
  outline: none;
}

.fh-annot-panel {
  position: fixed;
  left: 18px;
  bottom: 66px;
  z-index: 10011;
  display: none;
  width: min(380px, calc(100vw - 28px));
  max-height: min(620px, calc(100vh - 96px));
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.24);
}

.fh-annot-panel.open {
  display: flex;
  flex-direction: column;
}

.fh-annot-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
}

.fh-annot-panel-title {
  flex: 1;
  color: #0f172a;
  font-size: 15px;
  font-weight: 800;
}

.fh-annot-list {
  overflow: auto;
  padding: 10px;
}

.fh-annot-empty {
  padding: 18px 14px;
  color: #64748b;
  font-size: 14px;
  line-height: 1.7;
}

.fh-annot-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  margin-bottom: 10px;
  padding: 10px 11px;
}

.fh-annot-item-text {
  color: #1f2937;
  font-size: 14px;
  line-height: 1.55;
}

.fh-annot-item-note {
  margin-top: 7px;
  border-left: 3px solid #d97706;
  color: #7c2d12;
  background: #fff7ed;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.55;
  padding: 7px 9px;
  white-space: pre-wrap;
}

.fh-annot-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
  color: #64748b;
  font-size: 12px;
}

.fh-annot-mini-actions {
  display: flex;
  gap: 6px;
}

.fh-annot-mini {
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-size: 12px;
  padding: 4px 7px;
}

.fh-annot-mini:hover,
.fh-annot-mini:focus-visible {
  border-color: #2563eb;
  color: #1d4ed8;
  outline: none;
}

.fh-annot-editor {
  position: fixed;
  z-index: 10030;
  display: none;
  width: min(360px, calc(100vw - 28px));
  border: 1px solid #334155;
  border-radius: 12px;
  background: #0f172a;
  color: #e5e7eb;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.34);
  overflow: hidden;
}

.fh-annot-editor.open {
  display: block;
}

.fh-annot-editor-head {
  padding: 10px 12px;
  border-bottom: 1px solid #334155;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
}

.fh-annot-editor textarea {
  display: block;
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border: 0;
  background: #111827;
  color: #e5e7eb;
  font: 14px/1.55 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  outline: none;
  padding: 11px 12px;
}

.fh-annot-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
}

@media (max-width: 640px) {
  .fh-annot-fab {
    left: 12px;
    bottom: 12px;
  }

  .fh-annot-panel {
    left: 12px;
    bottom: 58px;
  }
}
