/* 家族谱字：跟文献页工具栏同一套暗红，避免做成市面常见的橙框拼字器 */
.fgm-overlay {
  position: fixed;
  inset: 0;
  z-index: 16000;
  background: rgba(17, 24, 39, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.fgm-overlay[hidden] { display: none !important; }
.fgm-modal {
  background: #fff;
  border-radius: 4px;
  width: min(1120px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.fgm-modal.is-compose {
  height: min(820px, 92vh);
}
.fgm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #8B0000;
  color: #fff;
}
.fgm-head h3 { font-size: 14px; font-weight: 700; letter-spacing: 0.04em; }
.fgm-head .fgm-btn {
  border-color: rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
}
.fgm-head .fgm-btn:hover { background: rgba(255, 255, 255, 0.12); }
.fgm-body { padding: 14px 16px; overflow: auto; flex: 1 1 auto; background: #F9FAFB; min-height: 0; }
.fgm-modal.is-compose .fgm-body {
  overflow: hidden;
  display: flex;
  padding: 12px 14px;
}
.fgm-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
}
.fgm-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 4px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  cursor: pointer;
}
.fgm-btn:hover { border-color: #8B0000; color: #8B0000; }
.fgm-btn-primary { background: #8B0000; border-color: #8B0000; color: #fff; }
.fgm-btn-primary:hover { background: #6B0000; border-color: #6B0000; color: #fff; }
.fgm-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.fgm-toolbar input {
  flex: 1 1 200px;
  min-width: 160px;
  height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 0 10px;
  background: #fff;
}
.fgm-rows { display: flex; flex-direction: column; gap: 8px; }
.fgm-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
}
.fgm-row-glyph {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-family: "ZongyuanFamilyEUDC", "SimSun", "Songti SC", serif;
  background: #f9fafb;
  border: 1px solid #f3f4f6;
}
.fgm-row-meta { flex: 1; font-size: 12px; color: #6b7280; }
.fgm-row-actions { display: flex; gap: 6px; }
.fgm-empty { color: #6b7280; font-size: 13px; padding: 24px 8px; text-align: center; }
.fgm-compose {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 14px;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
}
.fgm-parts-bar {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 8px 10px;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}
.fgm-paper-col {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.fgm-parts-add {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.fgm-parts-add input { flex: 1; height: 32px; border: 1px solid #d1d5db; border-radius: 4px; padding: 0 10px; }
.fgm-rad-group { margin-bottom: 6px; }
.fgm-rad-group h4 { font-size: 11px; color: #9ca3af; margin-bottom: 4px; font-weight: 600; }
.fgm-rad-btns { display: flex; flex-wrap: wrap; gap: 3px; }
.fgm-rad-btns button {
  min-width: 28px;
  height: 28px;
  border: 1px solid #e5e7eb;
  background: #F9FAFB;
  border-radius: 2px;
  font-family: "SimSun", serif;
  cursor: pointer;
}
.fgm-rad-btns button:hover { border-color: #8B0000; color: #8B0000; background: #fff; }
.fgm-paper-row { display: flex; justify-content: center; }
.fgm-canvas-wrap {
  width: min(440px, 42vw);
  height: min(440px, 42vw);
  background: #fffef8;
  border: 2px solid #8B0000;
  position: relative;
  user-select: none;
  box-shadow: 0 2px 0 #8B0000;
}
.fgm-comp {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "SimSun", "Songti SC", serif;
  color: #111;
  cursor: move;
  line-height: 1;
}
.fgm-comp.is-on { outline: 1px solid #8B0000; outline-offset: 1px; }
.fgm-stroke-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.fgm-stroke {
  fill: #111;
  cursor: pointer;
}
.fgm-stroke.is-plain { cursor: move; }
.fgm-comp.is-on .fgm-stroke:hover { fill: #8B0000; }
.fgm-stroke.is-hidden { fill: rgba(139, 0, 0, 0.16); }
.fgm-comp.is-on .fgm-stroke.is-hidden:hover { fill: rgba(139, 0, 0, 0.32); }
.fgm-restore {
  position: absolute;
  left: 4px;
  top: 4px;
  height: 22px;
  padding: 0 6px;
  font-size: 11px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #6b7280;
  border-radius: 2px;
  cursor: pointer;
  z-index: 2;
}
.fgm-restore:hover { border-color: #8B0000; color: #8B0000; }
.fgm-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #8B0000;
  right: -4px;
  bottom: -4px;
  cursor: nwse-resize;
}
.fgm-tip {
  color: #6b7280;
  font-size: 12px;
  text-align: center;
  max-width: min(440px, 42vw);
  line-height: 1.5;
}
