/**
 * 富文本：分割线、流光字、文字特效、圆角流光框
 * 容器：.gem-rich-content 或 .rte-editor
 */

/* —— 编辑区/正文默认字色（避免粘贴后看不见） —— */
.gem-rich-content,
.rte-editor.gem-rich-content {
  color: #1a2040;
  -webkit-text-fill-color: currentColor;
}

.gem-rich-content p,
.gem-rich-content div:not([class*="gem-flow-"]):not(.gem-frame),
.rte-editor p {
  margin: 0.35em 0;
  color: inherit;
  -webkit-text-fill-color: currentColor;
}

/* —— 普通分割线 —— */
.gem-rich-content .gem-hr,
.rte-editor .gem-hr {
  display: block;
  width: 100%;
  height: 1px;
  min-height: 1px;
  margin: 14px 0;
  padding: 0;
  border: none;
  background: rgba(100, 120, 180, 0.38);
}

.gem-rich-content .gem-hr-glow,
.rte-editor .gem-hr-glow {
  height: 3px;
  min-height: 3px;
  margin: 16px 0;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #5b8dee, #a78bfa, #49dfd7, transparent) !important;
  box-shadow: 0 0 14px rgba(91, 141, 238, 0.45);
  animation: gemHrGlowPulse 2.4s ease-in-out infinite;
}

.gem-rich-content .gem-hr-neon,
.rte-editor .gem-hr-neon {
  height: 3px;
  background: linear-gradient(90deg, transparent, #ff2d95, #a78bfa, #22d3ee, transparent) !important;
  box-shadow: 0 0 18px rgba(255, 45, 149, 0.55), 0 0 10px rgba(34, 211, 238, 0.35);
  animation: gemHrGlowPulse 1.6s ease-in-out infinite;
}

.gem-rich-content .gem-hr-sunset,
.rte-editor .gem-hr-sunset {
  height: 3px;
  background: linear-gradient(90deg, transparent, #f97316, #fbbf24, #e74a5a, transparent) !important;
  animation: gemHrGlowPulse 2.2s ease-in-out infinite;
}

.gem-rich-content .gem-hr-ocean,
.rte-editor .gem-hr-ocean {
  height: 3px;
  background: linear-gradient(90deg, transparent, #0ea5e9, #22d3ee, #2b6cb0, transparent) !important;
  animation: gemHrGlowPulse 2.5s ease-in-out infinite;
}

.gem-rich-content .gem-hr-double,
.rte-editor .gem-hr-double {
  height: 5px;
  border: none;
  background: none !important;
  border-top: 1px solid rgba(91, 141, 238, 0.45);
  border-bottom: 1px solid rgba(167, 139, 250, 0.35);
}

.gem-rich-content .gem-hr-dashed,
.rte-editor .gem-hr-dashed {
  height: 0;
  border: none;
  border-top: 2px dashed rgba(91, 141, 238, 0.55);
  background: none !important;
  box-shadow: 0 0 12px rgba(91, 141, 238, 0.2);
}

.gem-rich-content .gem-hr-wave,
.rte-editor .gem-hr-wave {
  height: 4px;
  border-radius: 4px;
  background: repeating-linear-gradient(90deg, #5b8dee 0, #5b8dee 8px, transparent 8px, transparent 14px, #a78bfa 14px, #a78bfa 22px, transparent 22px) !important;
  animation: gemHrWave 1.2s linear infinite;
}

.gem-rich-content .gem-hr-diamond,
.rte-editor .gem-hr-diamond {
  position: relative;
  height: 1px;
  margin: 22px 0;
  background: linear-gradient(90deg, transparent, rgba(100, 120, 180, 0.4), transparent) !important;
}

.gem-rich-content .gem-hr-diamond::after,
.rte-editor .gem-hr-diamond::after {
  content: '◆';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  color: #5b8dee;
  text-shadow: 0 0 10px rgba(91, 141, 238, 0.8);
  background: rgba(255, 255, 255, 0.9);
  padding: 0 6px;
  line-height: 1;
}

@keyframes gemHrGlowPulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

@keyframes gemHrWave {
  to { background-position: 28px 0; }
}

/* —— 圆角流光框：文字在框内展示 —— */
.gem-rich-content .gem-frame,
.rte-editor .gem-frame {
  position: relative;
  display: block;
  margin: 14px 0;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  color: #1a2040 !important;
  -webkit-text-fill-color: #1a2040 !important;
  line-height: 1.65;
  word-break: break-word;
  box-sizing: border-box;
  z-index: 0;
  min-height: 2.5em;
}

.gem-rich-content .gem-frame::before,
.rte-editor .gem-frame::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 20px;
  z-index: -1;
  background-size: 300% 100%;
  animation: gemFlowShift 3s linear infinite;
}

.gem-frame-blue::before { background-image: linear-gradient(90deg, #5b8dee, #49dfd7, #a78bfa, #5b8dee); }
.gem-frame-rainbow::before { background-image: linear-gradient(90deg, #e74a5a, #f5a623, #7ed321, #5b8dee, #a78bfa, #e74a5a); }
.gem-frame-gold::before { background-image: linear-gradient(90deg, #9a7b1a, #ffe566, #f5d76e, #9a7b1a); }
.gem-frame-neon::before { background-image: linear-gradient(90deg, #ff2d95, #c471ed, #22d3ee, #ff2d95); }
.gem-frame-aurora::before { background-image: linear-gradient(90deg, #0ea5e9, #22d3ee, #a78bfa, #f472b6, #0ea5e9); }
.gem-frame-rose::before { background-image: linear-gradient(90deg, #e11d48, #fb7185, #fda4af, #e11d48); }
.gem-frame-jade::before { background-image: linear-gradient(90deg, #059669, #34d399, #6ee7b7, #059669); }

.gem-rich-content .gem-frame p,
.gem-rich-content .gem-frame div,
.rte-editor .gem-frame p {
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
}

/* 兼容旧版「环绕分割线」→ 视为普通框 */
.gem-hr-orbit {
  display: block;
  margin: 14px 0;
  padding: 14px 18px;
  border-radius: 18px;
  border: 2px solid rgba(91, 141, 238, 0.45);
  min-height: 2em;
  color: #1a2040;
}

/* —— 流光字：仅作用于带 gem-flow- 的节点 —— */
.gem-rich-content .gem-flow-gold,
.gem-rich-content .gem-flow-rainbow,
.gem-rich-content .gem-flow-ice,
.gem-rich-content .gem-flow-violet,
.gem-rich-content .gem-flow-neon,
.gem-rich-content .gem-flow-aurora,
.gem-rich-content .gem-flow-flame,
.gem-rich-content .gem-flow-emerald,
.gem-rich-content .gem-flow-rose,
.gem-rich-content .gem-flow-sunset,
.gem-rich-content .gem-flow-ocean,
.gem-rich-content .gem-flow-lavender,
.gem-rich-content .gem-flow-cyber,
.gem-rich-content .gem-flow-matrix,
.gem-rich-content .gem-flow-sakura,
.gem-rich-content .gem-flow-mint,
.gem-rich-content .gem-flow-copper,
.gem-rich-content .gem-flow-silver,
.gem-rich-content .gem-flow-blood,
.gem-rich-content .gem-flow-jade,
.rte-editor .gem-flow-gold,
.rte-editor .gem-flow-rainbow,
.rte-editor .gem-flow-ice,
.rte-editor .gem-flow-violet,
.rte-editor .gem-flow-neon,
.rte-editor .gem-flow-aurora,
.rte-editor .gem-flow-flame,
.rte-editor .gem-flow-emerald,
.rte-editor .gem-flow-rose,
.rte-editor .gem-flow-sunset,
.rte-editor .gem-flow-ocean,
.rte-editor .gem-flow-lavender,
.rte-editor .gem-flow-cyber,
.rte-editor .gem-flow-matrix,
.rte-editor .gem-flow-sakura,
.rte-editor .gem-flow-mint,
.rte-editor .gem-flow-copper,
.rte-editor .gem-flow-silver,
.rte-editor .gem-flow-blood,
.rte-editor .gem-flow-jade {
  font-weight: 700 !important;
  display: inline !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  background-repeat: no-repeat !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  background-size: 220% 100% !important;
  animation: gemFlowShift 2.4s ease-in-out infinite;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  perspective: 1000px;
  contain: layout style paint;
  isolation: isolate;
}

.gem-flow-gold { background-image: linear-gradient(90deg, #9a7b1a, #ffe566, #f5d76e, #9a7b1a) !important; }
.gem-flow-rainbow { background-image: linear-gradient(90deg, #e74a5a, #f5a623, #7ed321, #5b8dee, #a78bfa, #e74a5a) !important; background-size: 300% 100% !important; animation-duration: 2.8s; animation-timing-function: linear; }
.gem-flow-ice { background-image: linear-gradient(90deg, #2b6cb0, #63b3ed, #bee3f8, #63b3ed, #2b6cb0) !important; }
.gem-flow-violet { background-image: linear-gradient(90deg, #553c9a, #9f7aea, #d6bcfa, #9f7aea, #553c9a) !important; }
.gem-flow-neon { background-image: linear-gradient(90deg, #ff2d95, #ff6bcb, #c471ed, #ff2d95) !important; filter: drop-shadow(0 0 5px rgba(255, 45, 149, 0.4)); }
.gem-flow-aurora { background-image: linear-gradient(90deg, #0ea5e9, #22d3ee, #a78bfa, #f472b6, #0ea5e9) !important; background-size: 280% 100% !important; animation-duration: 3s; animation-timing-function: linear; }
.gem-flow-flame { background-image: linear-gradient(90deg, #c2410c, #f97316, #fbbf24, #f97316, #c2410c) !important; animation-duration: 2s; }
.gem-flow-emerald { background-image: linear-gradient(90deg, #047857, #10b981, #6ee7b7, #10b981, #047857) !important; }
.gem-flow-rose { background-image: linear-gradient(90deg, #be123c, #fb7185, #fecdd3, #fb7185, #be123c) !important; }
.gem-flow-sunset { background-image: linear-gradient(90deg, #c2410c, #fb923c, #fde047, #fb923c, #c2410c) !important; }
.gem-flow-ocean { background-image: linear-gradient(90deg, #0369a1, #38bdf8, #7dd3fc, #38bdf8, #0369a1) !important; }
.gem-flow-lavender { background-image: linear-gradient(90deg, #6b21a8, #c084fc, #e9d5ff, #c084fc, #6b21a8) !important; }
.gem-flow-cyber { background-image: linear-gradient(90deg, #00f5ff, #00ff88, #bf00ff, #00f5ff) !important; background-size: 260% 100% !important; animation-duration: 1.5s; animation-timing-function: linear; }
.gem-flow-matrix { background-image: linear-gradient(90deg, #14532d, #22c55e, #86efac, #22c55e, #14532d) !important; }
.gem-flow-sakura { background-image: linear-gradient(90deg, #db2777, #f9a8d4, #fce7f3, #f9a8d4, #db2777) !important; }
.gem-flow-mint { background-image: linear-gradient(90deg, #0d9488, #5eead4, #ccfbf1, #5eead4, #0d9488) !important; }
.gem-flow-copper { background-image: linear-gradient(90deg, #78350f, #d97706, #fcd34d, #d97706, #78350f) !important; }
.gem-flow-silver { background-image: linear-gradient(90deg, #475569, #94a3b8, #f1f5f9, #94a3b8, #475569) !important; }
.gem-flow-blood { background-image: linear-gradient(90deg, #7f1d1d, #dc2626, #fca5a5, #dc2626, #7f1d1d) !important; }
.gem-flow-jade { background-image: linear-gradient(90deg, #064e3b, #14b8a6, #99f6e4, #14b8a6, #064e3b) !important; }

@keyframes gemFlowShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* —— 文字特效（保持可见，非渐变镂空） —— */
.gem-rich-content .gem-tx-shadow,
.rte-editor .gem-tx-shadow {
  font-weight: 700;
  color: #1a2040 !important;
  -webkit-text-fill-color: currentColor !important;
  text-shadow: 2px 2px 0 #5b8dee, 4px 4px 0 rgba(91, 141, 238, 0.35);
}

.gem-tx-outline {
  font-weight: 700;
  color: #5b8dee !important;
  -webkit-text-fill-color: currentColor !important;
  -webkit-text-stroke: 1px rgba(26, 32, 64, 0.25);
  text-shadow: 0 0 8px rgba(91, 141, 238, 0.5);
}

.gem-tx-3d {
  font-weight: 800;
  color: #3d52a0 !important;
  -webkit-text-fill-color: currentColor !important;
  text-shadow: 1px 1px 0 #a78bfa, 2px 2px 0 #5b8dee, 3px 3px 0 rgba(73, 223, 215, 0.5);
}

.gem-tx-glitch {
  font-weight: 700;
  color: #1a2040 !important;
  -webkit-text-fill-color: currentColor !important;
  text-shadow: 2px 0 #ff2d95, -2px 0 #22d3ee;
  animation: gemTxGlitch 2.5s steps(2) infinite;
}

.gem-tx-wave {
  font-weight: 700;
  color: #5b8dee !important;
  -webkit-text-fill-color: currentColor !important;
  display: inline-block !important;
  animation: gemTxWave 1.2s ease-in-out infinite;
}

.gem-tx-pulse {
  font-weight: 700;
  color: #e74a5a !important;
  -webkit-text-fill-color: currentColor !important;
  animation: gemTxPulse 1.4s ease-in-out infinite;
}

.gem-tx-shine {
  font-weight: 700;
  color: #1a2040 !important;
  -webkit-text-fill-color: currentColor !important;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.9) 50%, transparent 70%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: gemTxShine 2s ease-in-out infinite;
}

.gem-tx-retro {
  font-weight: 800;
  color: #fbbf24 !important;
  -webkit-text-fill-color: currentColor !important;
  letter-spacing: 0.06em;
  text-shadow: 3px 3px 0 #c2410c, -1px -1px 0 #1a2040;
}

.gem-tx-glow {
  font-weight: 700;
  color: #5b8dee !important;
  -webkit-text-fill-color: currentColor !important;
  text-shadow: 0 0 8px #5b8dee, 0 0 16px #a78bfa, 0 0 22px rgba(73, 223, 215, 0.55);
}

.gem-tx-underline-glow {
  font-weight: 600;
  color: #1a2040 !important;
  -webkit-text-fill-color: currentColor !important;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, #5b8dee, #a78bfa, #49dfd7) 1;
  padding-bottom: 2px;
}

.gem-rich-content .gem-tx-spin,
.rte-editor .gem-tx-spin {
  font-weight: 700;
  color: #5b8dee !important;
  -webkit-text-fill-color: currentColor !important;
  display: inline-block !important;
  animation: gemTxSpin 4s linear infinite;
}

.gem-rich-content .gem-tx-open,
.rte-editor .gem-tx-open {
  font-weight: 700;
  color: #3d52a0 !important;
  -webkit-text-fill-color: currentColor !important;
  display: inline-block !important;
  animation: gemTxOpen 2.4s ease-in-out infinite;
}

.gem-rich-content .gem-tx-flip,
.rte-editor .gem-tx-flip {
  font-weight: 700;
  color: #a78bfa !important;
  -webkit-text-fill-color: currentColor !important;
  display: inline-block !important;
  animation: gemTxFlip 3s ease-in-out infinite;
}

.gem-rich-content .gem-tx-bounce,
.rte-editor .gem-tx-bounce {
  font-weight: 700;
  color: #49dfd7 !important;
  -webkit-text-fill-color: currentColor !important;
  display: inline-block !important;
  animation: gemTxBounce 1.1s ease-in-out infinite;
}

.gem-rich-content .gem-tx-breathe,
.rte-editor .gem-tx-breathe {
  font-weight: 700;
  color: #e74a5a !important;
  -webkit-text-fill-color: currentColor !important;
  display: inline-block !important;
  animation: gemTxPulse 1.4s ease-in-out infinite;
}

@keyframes gemTxGlitch {
  0%, 90%, 100% { text-shadow: 2px 0 #ff2d95, -2px 0 #22d3ee; }
  92% { text-shadow: -2px 0 #ff2d95, 2px 0 #22d3ee; }
}

@keyframes gemTxWave {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes gemTxPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.04); opacity: 0.92; }
}

@keyframes gemTxShine {
  0%, 100% { background-position: 200% 50%; }
  50% { background-position: -50% 50%; }
}

@keyframes gemTxSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes gemTxOpen {
  0%, 100% { letter-spacing: 0.02em; transform: scaleX(1); }
  50% { letter-spacing: 0.28em; transform: scaleX(1.08); }
}

@keyframes gemTxFlip {
  0%, 100% { transform: perspective(400px) rotateY(0deg); }
  50% { transform: perspective(400px) rotateY(360deg); }
}

@keyframes gemTxBounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
  60% { transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  .gem-hr-glow, .gem-hr-neon, .gem-hr-sunset, .gem-hr-ocean, .gem-hr-wave,
  [class*="gem-flow-"], .gem-frame::before, .gem-tx-glitch, .gem-tx-wave, .gem-tx-pulse, .gem-tx-shine,
  .gem-tx-spin, .gem-tx-open, .gem-tx-flip, .gem-tx-bounce, .gem-tx-breathe {
    animation: none !important;
  }
}

@media (max-width: 768px) {
  .gem-rich-content .gem-flow-neon,
  .rte-editor .gem-flow-neon {
    filter: none !important;
  }
}
