/* El contenido del editor trae estilos propios e inline. Estas reglas solo
   adaptan su contraste en modo oscuro, sin cambiar las normativas guardadas. */
body:not(.light-mode) #dynamicContent {
  color: var(--text-primary);
}

body:not(.light-mode) #dynamicContent :is(
  .nota-violeta, .alert-violeta, .role-card, .tip, .alerta, .alert,
  .nota-gna, .alert-gna, .nota-pdlc, .alert-pdlc, .nota-psg, .alert-psg,
  .nota-importante, .fbi-note, .fbi-warning, .militar-note, .militar-warning,
  .command-mini, .command-box, .keycard, .rango-item,
  :where(div)[style*="background" i]
) {
  background: var(--surface-2) !important;
  color: var(--text-primary) !important;
}

body:not(.light-mode) #dynamicContent :is(
  .nota-violeta, .alert-violeta, .role-card, .tip, .alerta, .alert,
  .nota-gna, .alert-gna, .nota-pdlc, .alert-pdlc, .nota-psg, .alert-psg,
  .nota-importante, .fbi-note, .fbi-warning, .militar-note, .militar-warning,
  .command-mini, .command-box, .keycard, .rango-item,
  :where(div)[style*="background" i]
) :where(p, li, div, span, strong, b, em, small, h1, h2, h3, h4, h5, h6) {
  color: var(--text-primary) !important;
}

body:not(.light-mode) #dynamicContent :is(.nota-violeta, .alert-violeta, .command-mini, .command-box, .keycard) {
  background: #251e3b !important;
  border-left-color: #a78bfa !important;
}

body:not(.light-mode) #dynamicContent :is(.tip, .alert-success, .nota-gna, .alert-gna, .nota-importante, .militar-note) {
  background: #142d25 !important;
  border-left-color: #4ade80 !important;
}

body:not(.light-mode) #dynamicContent :is(.alerta, .alert-danger) {
  background: #361e28 !important;
  border-left-color: #fb7185 !important;
}

body:not(.light-mode) #dynamicContent :is(.alert-warning, .nota-psg, .alert-psg, .fbi-warning, .militar-warning) {
  background: #332b1b !important;
  border-left-color: #fbbf24 !important;
}

body:not(.light-mode) #dynamicContent :is(.alert-info, .nota-pdlc, .alert-pdlc, .fbi-note) {
  background: #182c43 !important;
  border-left-color: #60a5fa !important;
}

body:not(.light-mode) #dynamicContent .rango-item:hover {
  background: var(--surface-3) !important;
}

body:not(.light-mode) #dynamicContent :is(.role-title, .role-description, .aclaracion) {
  color: var(--text-primary) !important;
}

body:not(.light-mode) #dynamicContent :is(.text-purple, .role-icon, .command-mini i, .btn-outline-purple) {
  color: #c4b5fd !important;
}

/* Algunos titulos llegan como strong/em con el color guardado en el editor. */
body:not(.light-mode) #dynamicContent :is(h1, h2, h3, h4, h5, h6, strong, b, em, span):is(
  [style*="#4b0082" i], [style*="#6a1b9a" i], [style*="#25003f" i],
  [style*="rgb(75, 0, 130)" i], [style*="rgb(75,0,130)" i],
  [style*="rgb(37, 0, 63)" i], [style*="rgb(37,0,63)" i]
),
body:not(.light-mode) #dynamicContent .role-title {
  color: #c4b5fd !important;
}

body:not(.light-mode) #dynamicContent :is(h1, h2, h3, h4, h5, h6, .role-title, strong[style*="color" i]) :is(strong, b, em, span) {
  color: inherit !important;
}

body:not(.light-mode) #dynamicContent :is(code, kbd, .puntado) {
  background: #302547 !important;
  color: #ede9fe !important;
}

body:not(.light-mode) #dynamicContent :is(mark, .resaltador) {
  background: #422f13 !important;
  color: #fef08a !important;
}

body:not(.light-mode) #dynamicContent table {
  background: #111827 !important;
  color: var(--text-primary) !important;
}

body:not(.light-mode) #dynamicContent table :is(thead, tbody, tr) {
  background: transparent !important;
  color: var(--text-primary) !important;
}

body:not(.light-mode) #dynamicContent table tbody tr:nth-child(odd) {
  background: #182236 !important;
}

body:not(.light-mode) #dynamicContent table tbody tr:nth-child(even) {
  background: #202d43 !important;
}

body:not(.light-mode) #dynamicContent table :is(td, th) {
  border-color: #43516a !important;
  color: var(--text-primary) !important;
}

body:not(.light-mode) #dynamicContent table td {
  background: transparent !important;
}

body:not(.light-mode) #dynamicContent table th {
  background: #5b21b6 !important;
  color: #fff !important;
}

body:not(.light-mode) #dynamicContent table :is(td, th) :is(p, span, strong, b, em, small) {
  color: inherit !important;
}

body:not(.light-mode) #dynamicContent table tbody tr:hover td {
  background: #33415c !important;
}
